@choice-ui/react 1.7.6 → 1.7.8

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 (311) hide show
  1. package/dist/components/colors/dist/index.d.ts +878 -0
  2. package/dist/components/colors/scripts/build-worker.d.ts +1 -0
  3. package/dist/components/colors/src/check-color-contrast/check-color-contrast-boundary.d.ts +14 -0
  4. package/dist/components/colors/src/check-color-contrast/check-color-contrast-boundary.js +403 -0
  5. package/dist/components/colors/src/check-color-contrast/check-color-contrast-toolbar.d.ts +12 -0
  6. package/dist/components/colors/src/check-color-contrast/check-color-contrast-toolbar.js +285 -0
  7. package/dist/components/colors/src/check-color-contrast/index.d.ts +2 -0
  8. package/dist/components/colors/src/color-area/color-area.d.ts +24 -0
  9. package/dist/components/colors/src/color-area/color-area.js +228 -0
  10. package/dist/components/colors/src/color-area/index.d.ts +1 -0
  11. package/dist/components/colors/src/color-area/tv.d.ts +34 -0
  12. package/dist/components/colors/src/color-area/tv.js +22 -0
  13. package/dist/components/colors/src/color-channel-field/color-channel-field.d.ts +22 -0
  14. package/dist/components/colors/src/color-channel-field/color-channel-field.js +110 -0
  15. package/dist/components/colors/src/color-channel-field/color-channel-input.d.ts +20 -0
  16. package/dist/components/colors/src/color-channel-field/color-channel-input.js +261 -0
  17. package/dist/components/colors/src/color-channel-field/index.d.ts +1 -0
  18. package/dist/components/colors/src/color-channel-field/tv.d.ts +101 -0
  19. package/dist/components/colors/src/color-channel-field/tv.js +85 -0
  20. package/dist/components/colors/src/color-gradients-paint/color-gradient-combined.d.ts +16 -0
  21. package/dist/components/colors/src/color-gradients-paint/color-gradient-combined.js +54 -0
  22. package/dist/components/colors/src/color-gradients-paint/color-gradient-control.d.ts +18 -0
  23. package/dist/components/colors/src/color-gradients-paint/color-gradient-control.js +149 -0
  24. package/dist/components/colors/src/color-gradients-paint/color-gradient-list.d.ts +20 -0
  25. package/dist/components/colors/src/color-gradients-paint/color-gradient-list.js +111 -0
  26. package/dist/components/colors/src/color-gradients-paint/color-gradient-slider.d.ts +18 -0
  27. package/dist/components/colors/src/color-gradients-paint/color-gradient-slider.js +281 -0
  28. package/dist/components/colors/src/color-gradients-paint/color-gradients-paint.d.ts +17 -0
  29. package/dist/components/colors/src/color-gradients-paint/color-gradients-paint.js +162 -0
  30. package/dist/components/colors/src/color-gradients-paint/color-gradients-toolbar.d.ts +10 -0
  31. package/dist/components/colors/src/color-gradients-paint/color-gradients-toolbar.js +62 -0
  32. package/dist/components/colors/src/color-gradients-paint/index.d.ts +3 -0
  33. package/dist/components/colors/src/color-image-paint/color-image-paint.d.ts +13 -0
  34. package/dist/components/colors/src/color-image-paint/color-image-paint.js +236 -0
  35. package/dist/components/colors/src/color-image-paint/color-image-toolbar.d.ts +9 -0
  36. package/dist/components/colors/src/color-image-paint/color-image-toolbar.js +52 -0
  37. package/dist/components/colors/src/color-image-paint/index.d.ts +1 -0
  38. package/dist/components/colors/src/color-image-paint/tv.d.ts +89 -0
  39. package/dist/components/colors/src/color-image-paint/tv.js +45 -0
  40. package/dist/components/colors/src/color-picker-content/color-picker-content.d.ts +18 -0
  41. package/dist/components/colors/src/color-picker-content/color-picker-content.js +58 -0
  42. package/dist/components/colors/src/color-picker-content/color-picker-custom-content.d.ts +16 -0
  43. package/dist/components/colors/src/color-picker-content/color-picker-custom-content.js +75 -0
  44. package/dist/components/colors/src/color-picker-content/index.d.ts +1 -0
  45. package/dist/components/colors/src/color-picker-content/paint-type-selector.d.ts +13 -0
  46. package/dist/components/colors/src/color-picker-content/paint-type-selector.js +50 -0
  47. package/dist/components/colors/src/color-picker-content/tv.d.ts +31 -0
  48. package/dist/components/colors/src/color-picker-content/tv.js +13 -0
  49. package/dist/components/colors/src/color-picker-popover/color-paints-type.d.ts +15 -0
  50. package/dist/components/colors/src/color-picker-popover/color-paints-type.js +56 -0
  51. package/dist/components/colors/src/color-picker-popover/color-picker-popover.d.ts +26 -0
  52. package/dist/components/colors/src/color-picker-popover/color-picker-popover.js +116 -0
  53. package/dist/components/colors/src/color-picker-popover/color-picker-tabs.d.ts +14 -0
  54. package/dist/components/colors/src/color-picker-popover/color-picker-tabs.js +47 -0
  55. package/dist/components/colors/src/color-picker-popover/color-picker-title.d.ts +14 -0
  56. package/dist/components/colors/src/color-picker-popover/color-picker-title.js +30 -0
  57. package/dist/components/colors/src/color-picker-popover/index.d.ts +3 -0
  58. package/dist/components/colors/src/color-picker-popover/tv.d.ts +37 -0
  59. package/dist/components/colors/src/color-slider/color-slider.d.ts +19 -0
  60. package/dist/components/colors/src/color-slider/color-slider.js +185 -0
  61. package/dist/components/colors/src/color-slider/index.d.ts +1 -0
  62. package/dist/components/colors/src/color-slider/tv.d.ts +31 -0
  63. package/dist/components/colors/src/color-slider/tv.js +21 -0
  64. package/dist/components/colors/src/color-solid-paint/color-native-picker.d.ts +8 -0
  65. package/dist/components/colors/src/color-solid-paint/color-native-picker.js +63 -0
  66. package/dist/components/colors/src/color-solid-paint/color-solid-paint.d.ts +25 -0
  67. package/dist/components/colors/src/color-solid-paint/color-solid-paint.js +295 -0
  68. package/dist/components/colors/src/color-solid-paint/index.d.ts +3 -0
  69. package/dist/components/colors/src/color-solid-paint/solid-paint-alpha-slider.d.ts +10 -0
  70. package/dist/components/colors/src/color-solid-paint/solid-paint-alpha-slider.js +20 -0
  71. package/dist/components/colors/src/color-solid-paint/solid-paint-area.d.ts +17 -0
  72. package/dist/components/colors/src/color-solid-paint/solid-paint-area.js +131 -0
  73. package/dist/components/colors/src/color-solid-paint/solid-paint-channel-field.d.ts +20 -0
  74. package/dist/components/colors/src/color-solid-paint/solid-paint-channel-field.js +147 -0
  75. package/dist/components/colors/src/color-solid-paint/solid-paint-hue-slider.d.ts +14 -0
  76. package/dist/components/colors/src/color-solid-paint/solid-paint-hue-slider.js +46 -0
  77. package/dist/components/colors/src/color-solid-paint/solid-paint-library-item.d.ts +8 -0
  78. package/dist/components/colors/src/color-solid-paint/tv.d.ts +79 -0
  79. package/dist/components/colors/src/color-solid-paint/tv.js +39 -0
  80. package/dist/components/colors/src/color-swatch/color-swatch.d.ts +15 -0
  81. package/dist/components/colors/src/color-swatch/color-swatch.js +111 -0
  82. package/dist/components/colors/src/color-swatch/index.d.ts +1 -0
  83. package/dist/components/colors/src/contents/color-space.d.ts +19 -0
  84. package/dist/components/colors/src/contents/color-space.js +16 -0
  85. package/dist/components/colors/src/contents/colors.d.ts +42 -0
  86. package/dist/components/colors/src/contents/colors.js +24 -0
  87. package/dist/components/colors/src/contents/index.d.ts +3 -0
  88. package/dist/components/colors/src/contents/translation.d.ts +100 -0
  89. package/dist/components/colors/src/contents/translation.js +94 -0
  90. package/dist/components/colors/src/context/colots-context.d.ts +24 -0
  91. package/dist/components/colors/src/context/colots-context.js +62 -0
  92. package/dist/components/colors/src/context/index.d.ts +1 -0
  93. package/dist/components/colors/src/fill-input/alpha-input.d.ts +12 -0
  94. package/dist/components/colors/src/fill-input/alpha-input.js +48 -0
  95. package/dist/components/colors/src/fill-input/color-input.d.ts +31 -0
  96. package/dist/components/colors/src/fill-input/color-input.js +115 -0
  97. package/dist/components/colors/src/fill-input/gradient-item.d.ts +25 -0
  98. package/dist/components/colors/src/fill-input/gradient-item.js +103 -0
  99. package/dist/components/colors/src/fill-input/image-item.d.ts +25 -0
  100. package/dist/components/colors/src/fill-input/image-item.js +89 -0
  101. package/dist/components/colors/src/fill-input/index.d.ts +5 -0
  102. package/dist/components/colors/src/fill-input/tv.d.ts +221 -0
  103. package/dist/components/colors/src/fill-input/tv.js +205 -0
  104. package/dist/components/colors/src/fill-input/variable-item.d.ts +22 -0
  105. package/dist/components/colors/src/fill-input/variable-item.js +105 -0
  106. package/dist/components/colors/src/hex-input/hex-input.d.ts +10 -0
  107. package/dist/components/colors/src/hex-input/hex-input.js +182 -0
  108. package/dist/components/colors/src/hex-input/index.d.ts +1 -0
  109. package/dist/components/colors/src/hex-input/tv.d.ts +1 -0
  110. package/dist/components/colors/src/hex-input/tv.js +12 -0
  111. package/dist/components/colors/src/hooks/index.d.ts +10 -0
  112. package/dist/components/colors/src/hooks/use-color-contrast-recommendation.d.ts +36 -0
  113. package/dist/components/colors/src/hooks/use-color-contrast-recommendation.js +502 -0
  114. package/dist/components/colors/src/hooks/use-color-parser.d.ts +10 -0
  115. package/dist/components/colors/src/hooks/use-color-parser.js +146 -0
  116. package/dist/components/colors/src/hooks/use-color-picker.d.ts +45 -0
  117. package/dist/components/colors/src/hooks/use-color-picker.js +117 -0
  118. package/dist/components/colors/src/hooks/use-color-profile.d.ts +2 -0
  119. package/dist/components/colors/src/hooks/use-color-profile.js +27 -0
  120. package/dist/components/colors/src/hooks/use-cursor.d.ts +1 -0
  121. package/dist/components/colors/src/hooks/use-cursor.js +25 -0
  122. package/dist/components/colors/src/hooks/use-features.d.ts +21 -0
  123. package/dist/components/colors/src/hooks/use-features.js +73 -0
  124. package/dist/components/colors/src/hooks/use-image-filter-style.d.ts +9 -0
  125. package/dist/components/colors/src/hooks/use-image-filter-style.js +25 -0
  126. package/dist/components/colors/src/hooks/use-image-processor.d.ts +10 -0
  127. package/dist/components/colors/src/hooks/use-image-processor.js +121 -0
  128. package/dist/components/colors/src/hooks/use-paint-state.d.ts +16 -0
  129. package/dist/components/colors/src/hooks/use-paint-state.js +37 -0
  130. package/dist/components/colors/src/hooks/use-rgb-color-handler.d.ts +21 -0
  131. package/dist/components/colors/src/hooks/use-rgb-color-handler.js +58 -0
  132. package/dist/components/colors/src/index.d.ts +38 -0
  133. package/dist/components/colors/src/libraries/components/virtualized-grid-row.d.ts +36 -0
  134. package/dist/components/colors/src/libraries/components/virtualized-grid-row.js +53 -0
  135. package/dist/components/colors/src/libraries/components/virtualized-header.d.ts +9 -0
  136. package/dist/components/colors/src/libraries/components/virtualized-header.js +30 -0
  137. package/dist/components/colors/src/libraries/hooks/index.d.ts +2 -0
  138. package/dist/components/colors/src/libraries/hooks/use-category-options.d.ts +11 -0
  139. package/dist/components/colors/src/libraries/hooks/use-category-options.js +27 -0
  140. package/dist/components/colors/src/libraries/hooks/use-palette-color.d.ts +19 -0
  141. package/dist/components/colors/src/libraries/hooks/use-palette-color.js +41 -0
  142. package/dist/components/colors/src/libraries/index.d.ts +8 -0
  143. package/dist/components/colors/src/libraries/libraries-content.d.ts +8 -0
  144. package/dist/components/colors/src/libraries/libraries-empty-content.d.ts +5 -0
  145. package/dist/components/colors/src/libraries/libraries-header.d.ts +18 -0
  146. package/dist/components/colors/src/libraries/libraries-header.js +111 -0
  147. package/dist/components/colors/src/libraries/libraries-search-empty-content.d.ts +1 -0
  148. package/dist/components/colors/src/libraries/libraries-search-input.d.ts +6 -0
  149. package/dist/components/colors/src/libraries/libraries.d.ts +42 -0
  150. package/dist/components/colors/src/libraries/libraries.js +461 -0
  151. package/dist/components/colors/src/libraries/library-color-swatch.d.ts +21 -0
  152. package/dist/components/colors/src/libraries/library-item/index.d.ts +4 -0
  153. package/dist/components/colors/src/libraries/library-item/library-item.d.ts +21 -0
  154. package/dist/components/colors/src/libraries/library-item/library-item.js +151 -0
  155. package/dist/components/colors/src/libraries/library-item/library-list-item.d.ts +6 -0
  156. package/dist/components/colors/src/libraries/library-item/style-items.d.ts +17 -0
  157. package/dist/components/colors/src/libraries/library-item/style-items.js +63 -0
  158. package/dist/components/colors/src/libraries/library-item/variable-items.d.ts +19 -0
  159. package/dist/components/colors/src/libraries/library-item/variable-items.js +47 -0
  160. package/dist/components/colors/src/libraries/tv.d.ts +198 -0
  161. package/dist/components/colors/src/libraries/tv.js +141 -0
  162. package/dist/components/colors/src/simple-color-picker/index.d.ts +1 -0
  163. package/dist/components/colors/src/simple-color-picker/simple-color-picker.d.ts +17 -0
  164. package/dist/components/colors/src/simple-color-picker/simple-color-picker.js +153 -0
  165. package/dist/components/colors/src/types/base.d.ts +5 -0
  166. package/dist/components/colors/src/types/colors.d.ts +139 -0
  167. package/dist/components/colors/src/types/effect.d.ts +18 -0
  168. package/dist/components/colors/src/types/fill.d.ts +15 -0
  169. package/dist/components/colors/src/types/fonts.d.ts +38 -0
  170. package/dist/components/colors/src/types/index.d.ts +7 -0
  171. package/dist/components/colors/src/types/libraries.d.ts +7 -0
  172. package/dist/components/colors/src/types/paint.d.ts +139 -0
  173. package/dist/components/colors/src/types/style.d.ts +51 -0
  174. package/dist/components/colors/src/types/testing-library.d.ts +0 -0
  175. package/dist/components/colors/src/types/util.d.ts +26 -0
  176. package/dist/components/colors/src/types/variable.d.ts +27 -0
  177. package/dist/components/colors/src/utils/background.d.ts +12 -0
  178. package/dist/components/colors/src/utils/background.js +216 -0
  179. package/dist/components/colors/src/utils/color-profile-storage.d.ts +29 -0
  180. package/dist/components/colors/src/utils/color.d.ts +20 -0
  181. package/dist/components/colors/src/utils/color.js +45 -0
  182. package/dist/components/colors/src/utils/colors-convert.d.ts +18 -0
  183. package/dist/components/colors/src/utils/colors-convert.js +138 -0
  184. package/dist/components/colors/src/utils/contrast-utils.d.ts +27 -0
  185. package/dist/components/colors/src/utils/contrast-utils.js +25 -0
  186. package/dist/components/colors/src/utils/cursor.d.ts +1 -0
  187. package/dist/components/colors/src/utils/index.d.ts +7 -0
  188. package/dist/components/colors/src/utils/math.d.ts +9 -0
  189. package/dist/components/colors/src/utils/position.d.ts +33 -0
  190. package/dist/components/colors/src/utils/position.js +60 -0
  191. package/dist/components/colors/src/utils/validate.d.ts +10 -0
  192. package/dist/components/colors/src/workers/boundary-calculator.worker.bundled.d.ts +2 -0
  193. package/dist/components/colors/src/workers/boundary-calculator.worker.bundled.js +36 -0
  194. package/dist/components/colors/src/workers/boundary-calculator.worker.d.ts +1 -0
  195. package/dist/components/colors/src/workers/index.d.ts +1 -0
  196. package/dist/components/colors/tsup.config.d.ts +2 -0
  197. package/dist/components/icon-button/src/icon-button.d.ts +1 -1
  198. package/dist/components/icon-button/src/tv.d.ts +9 -0
  199. package/dist/components/icon-button/src/tv.js +29 -0
  200. package/dist/components/index.d.ts +1 -0
  201. package/dist/components/textarea/src/tv.d.ts +9 -3
  202. package/dist/components/textarea/src/tv.js +3 -1
  203. package/dist/components/toggle-button/dist/index.js +602 -0
  204. package/dist/index.js +69 -0
  205. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/index.js +119 -0
  206. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/Color.js +42 -0
  207. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/chroma.js +9 -0
  208. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/colors/colorbrewer.js +57 -0
  209. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/colors/w3cx11.js +159 -0
  210. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/average.js +82 -0
  211. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/bezier.js +68 -0
  212. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/blend.js +43 -0
  213. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/cubehelix.js +81 -0
  214. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/mix.js +20 -0
  215. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/random.js +13 -0
  216. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/scale.js +325 -0
  217. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/_hsx.js +54 -0
  218. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/hcg.js +10 -0
  219. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/hsi.js +10 -0
  220. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/hsl.js +10 -0
  221. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/hsv.js +10 -0
  222. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/index.js +4 -0
  223. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/lab.js +17 -0
  224. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/lch.js +11 -0
  225. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/lrgb.js +17 -0
  226. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/num.js +12 -0
  227. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/oklab.js +17 -0
  228. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/oklch.js +10 -0
  229. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/rgb.js +16 -0
  230. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/cmyk/cmyk2rgb.js +20 -0
  231. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/cmyk/index.js +25 -0
  232. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/cmyk/rgb2cmyk.js +18 -0
  233. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/css2rgb.js +169 -0
  234. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/hsl2css.js +20 -0
  235. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/index.js +23 -0
  236. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/lab2css.js +19 -0
  237. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/lch2css.js +19 -0
  238. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/oklab2css.js +17 -0
  239. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/oklch2css.js +17 -0
  240. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/rgb2css.js +53 -0
  241. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/gl/index.js +21 -0
  242. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hcg/hcg2rgb.js +48 -0
  243. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hcg/index.js +25 -0
  244. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hcg/rgb2hcg.js +24 -0
  245. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hex/hex2rgb.js +37 -0
  246. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hex/index.js +23 -0
  247. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hex/rgb2hex.js +31 -0
  248. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsi/hsi2rgb.js +36 -0
  249. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsi/index.js +25 -0
  250. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsi/rgb2hsi.js +28 -0
  251. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsl/hsl2rgb.js +35 -0
  252. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsl/index.js +25 -0
  253. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsl/rgb2hsl.js +29 -0
  254. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsv/hsv2rgb.js +46 -0
  255. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsv/index.js +25 -0
  256. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsv/rgb2hsv.js +27 -0
  257. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/input.js +7 -0
  258. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lab/index.js +28 -0
  259. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lab/lab-constants.js +106 -0
  260. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lab/lab2rgb.js +59 -0
  261. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lab/rgb2lab.js +51 -0
  262. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/hcl2rgb.js +10 -0
  263. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/index.js +35 -0
  264. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/lab2lch.js +13 -0
  265. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/lch2lab.js +12 -0
  266. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/lch2rgb.js +14 -0
  267. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/rgb2lch.js +13 -0
  268. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/named/index.js +26 -0
  269. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/num/index.js +23 -0
  270. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/num/num2rgb.js +13 -0
  271. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/num/rgb2num.js +9 -0
  272. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklab/index.js +25 -0
  273. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklab/oklab2rgb.js +31 -0
  274. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklab/rgb2oklab.js +30 -0
  275. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklch/index.js +25 -0
  276. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklch/oklch2rgb.js +14 -0
  277. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklch/rgb2oklch.js +13 -0
  278. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/rgb/index.js +34 -0
  279. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/temp/index.js +16 -0
  280. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/temp/rgb2temperature.js +25 -0
  281. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/temp/temperature2rgb.js +18 -0
  282. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/alpha.js +12 -0
  283. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/clipped.js +4 -0
  284. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/darken.js +14 -0
  285. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/get.js +12 -0
  286. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/luminance.js +38 -0
  287. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/mix.js +5 -0
  288. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/premultiply.js +11 -0
  289. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/saturate.js +13 -0
  290. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/set.js +42 -0
  291. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/shade.js +9 -0
  292. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/analyze.js +161 -0
  293. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/clip_rgb.js +17 -0
  294. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/contrast.js +12 -0
  295. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/contrastAPCA.js +43 -0
  296. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/delta-e.js +48 -0
  297. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/distance.js +16 -0
  298. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/index.js +24 -0
  299. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/last.js +10 -0
  300. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/limit.js +7 -0
  301. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/multiply-matrices.js +29 -0
  302. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/scales.js +16 -0
  303. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/type.js +20 -0
  304. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/unpack.js +11 -0
  305. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/valid.js +12 -0
  306. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/version.js +4 -0
  307. package/dist/node_modules/.pnpm/fuse.js@7.1.0/node_modules/fuse.js/dist/fuse.js +1317 -0
  308. package/dist/styles/components.css +55 -0
  309. package/dist/tailwind.css +1 -0
  310. package/package.json +32 -20
  311. package/dist/components/virtual-select/dist/index.d.ts +0 -48
@@ -0,0 +1,17 @@
1
+ import Color from "../Color.js";
2
+ import index from "./index.js";
3
+ const { sqrt, pow } = Math;
4
+ const lrgb = (col1, col2, f) => {
5
+ const [x1, y1, z1] = col1._rgb;
6
+ const [x2, y2, z2] = col2._rgb;
7
+ return new Color(
8
+ sqrt(pow(x1, 2) * (1 - f) + pow(x2, 2) * f),
9
+ sqrt(pow(y1, 2) * (1 - f) + pow(y2, 2) * f),
10
+ sqrt(pow(z1, 2) * (1 - f) + pow(z2, 2) * f),
11
+ "rgb"
12
+ );
13
+ };
14
+ index.lrgb = lrgb;
15
+ export {
16
+ lrgb as default
17
+ };
@@ -0,0 +1,12 @@
1
+ import "../io/num/index.js";
2
+ import index from "./index.js";
3
+ import Color from "../Color.js";
4
+ const num = (col1, col2, f) => {
5
+ const c1 = col1.num();
6
+ const c2 = col2.num();
7
+ return new Color(c1 + f * (c2 - c1), "num");
8
+ };
9
+ index.num = num;
10
+ export {
11
+ num as default
12
+ };
@@ -0,0 +1,17 @@
1
+ import "../io/oklab/index.js";
2
+ import index from "./index.js";
3
+ import Color from "../Color.js";
4
+ const oklab = (col1, col2, f) => {
5
+ const xyz0 = col1.oklab();
6
+ const xyz1 = col2.oklab();
7
+ return new Color(
8
+ xyz0[0] + f * (xyz1[0] - xyz0[0]),
9
+ xyz0[1] + f * (xyz1[1] - xyz0[1]),
10
+ xyz0[2] + f * (xyz1[2] - xyz0[2]),
11
+ "oklab"
12
+ );
13
+ };
14
+ index.oklab = oklab;
15
+ export {
16
+ oklab as default
17
+ };
@@ -0,0 +1,10 @@
1
+ import "../io/lch/index.js";
2
+ import interpolate_hsx from "./_hsx.js";
3
+ import index from "./index.js";
4
+ const oklch = (col1, col2, f) => {
5
+ return interpolate_hsx(col1, col2, f, "oklch");
6
+ };
7
+ index.oklch = oklch;
8
+ export {
9
+ oklch as default
10
+ };
@@ -0,0 +1,16 @@
1
+ import Color from "../Color.js";
2
+ import index from "./index.js";
3
+ const rgb = (col1, col2, f) => {
4
+ const xyz0 = col1._rgb;
5
+ const xyz1 = col2._rgb;
6
+ return new Color(
7
+ xyz0[0] + f * (xyz1[0] - xyz0[0]),
8
+ xyz0[1] + f * (xyz1[1] - xyz0[1]),
9
+ xyz0[2] + f * (xyz1[2] - xyz0[2]),
10
+ "rgb"
11
+ );
12
+ };
13
+ index.rgb = rgb;
14
+ export {
15
+ rgb as default
16
+ };
@@ -0,0 +1,20 @@
1
+ import "../../utils/type.js";
2
+ import unpack from "../../utils/unpack.js";
3
+ const cmyk2rgb = (...args) => {
4
+ args = unpack(args, "cmyk");
5
+ const [c, m, y, k] = args;
6
+ const alpha = args.length > 4 ? args[4] : 1;
7
+ if (k === 1) return [0, 0, 0, alpha];
8
+ return [
9
+ c >= 1 ? 0 : 255 * (1 - c) * (1 - k),
10
+ // r
11
+ m >= 1 ? 0 : 255 * (1 - m) * (1 - k),
12
+ // g
13
+ y >= 1 ? 0 : 255 * (1 - y) * (1 - k),
14
+ // b
15
+ alpha
16
+ ];
17
+ };
18
+ export {
19
+ cmyk2rgb as default
20
+ };
@@ -0,0 +1,25 @@
1
+ import chroma from "../../chroma.js";
2
+ import Color from "../../Color.js";
3
+ import input from "../input.js";
4
+ import type from "../../utils/type.js";
5
+ import unpack from "../../utils/unpack.js";
6
+ import cmyk2rgb from "./cmyk2rgb.js";
7
+ import rgb2cmyk from "./rgb2cmyk.js";
8
+ Color.prototype.cmyk = function() {
9
+ return rgb2cmyk(this._rgb);
10
+ };
11
+ const cmyk = (...args) => new Color(...args, "cmyk");
12
+ Object.assign(chroma, { cmyk });
13
+ input.format.cmyk = cmyk2rgb;
14
+ input.autodetect.push({
15
+ p: 2,
16
+ test: (...args) => {
17
+ args = unpack(args, "cmyk");
18
+ if (type(args) === "array" && args.length === 4) {
19
+ return "cmyk";
20
+ }
21
+ }
22
+ });
23
+ export {
24
+ cmyk
25
+ };
@@ -0,0 +1,18 @@
1
+ import "../../utils/type.js";
2
+ import unpack from "../../utils/unpack.js";
3
+ const { max } = Math;
4
+ const rgb2cmyk = (...args) => {
5
+ let [r, g, b] = unpack(args, "rgb");
6
+ r = r / 255;
7
+ g = g / 255;
8
+ b = b / 255;
9
+ const k = 1 - max(r, max(g, b));
10
+ const f = k < 1 ? 1 / (1 - k) : 0;
11
+ const c = (1 - r - k) * f;
12
+ const m = (1 - g - k) * f;
13
+ const y = (1 - b - k) * f;
14
+ return [c, m, y, k];
15
+ };
16
+ export {
17
+ rgb2cmyk as default
18
+ };
@@ -0,0 +1,169 @@
1
+ import hsl2rgb from "../hsl/hsl2rgb.js";
2
+ import lab2rgb from "../lab/lab2rgb.js";
3
+ import lch2rgb from "../lch/lch2rgb.js";
4
+ import oklab2rgb from "../oklab/oklab2rgb.js";
5
+ import oklch2rgb from "../oklch/oklch2rgb.js";
6
+ import input from "../input.js";
7
+ import limit from "../../utils/limit.js";
8
+ import { setLabWhitePoint, getLabWhitePoint } from "../lab/lab-constants.js";
9
+ const INT_OR_PCT = /((?:-?\d+)|(?:-?\d+(?:\.\d+)?)%|none)/.source;
10
+ const FLOAT_OR_PCT = /((?:-?(?:\d+(?:\.\d*)?|\.\d+)%?)|none)/.source;
11
+ const PCT = /((?:-?(?:\d+(?:\.\d*)?|\.\d+)%)|none)/.source;
12
+ const RE_S = /\s*/.source;
13
+ const SEP = /\s+/.source;
14
+ const COMMA = /\s*,\s*/.source;
15
+ const ANLGE = /((?:-?(?:\d+(?:\.\d*)?|\.\d+)(?:deg)?)|none)/.source;
16
+ const ALPHA = /\s*(?:\/\s*((?:[01]|[01]?\.\d+)|\d+(?:\.\d+)?%))?/.source;
17
+ const RE_RGB = new RegExp(
18
+ "^rgba?\\(" + RE_S + [INT_OR_PCT, INT_OR_PCT, INT_OR_PCT].join(SEP) + ALPHA + "\\)$"
19
+ );
20
+ const RE_RGB_LEGACY = new RegExp(
21
+ "^rgb\\(" + RE_S + [INT_OR_PCT, INT_OR_PCT, INT_OR_PCT].join(COMMA) + RE_S + "\\)$"
22
+ );
23
+ const RE_RGBA_LEGACY = new RegExp(
24
+ "^rgba\\(" + RE_S + [INT_OR_PCT, INT_OR_PCT, INT_OR_PCT, FLOAT_OR_PCT].join(COMMA) + RE_S + "\\)$"
25
+ );
26
+ const RE_HSL = new RegExp(
27
+ "^hsla?\\(" + RE_S + [ANLGE, PCT, PCT].join(SEP) + ALPHA + "\\)$"
28
+ );
29
+ const RE_HSL_LEGACY = new RegExp(
30
+ "^hsl?\\(" + RE_S + [ANLGE, PCT, PCT].join(COMMA) + RE_S + "\\)$"
31
+ );
32
+ const RE_HSLA_LEGACY = /^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/;
33
+ const RE_LAB = new RegExp(
34
+ "^lab\\(" + RE_S + [FLOAT_OR_PCT, FLOAT_OR_PCT, FLOAT_OR_PCT].join(SEP) + ALPHA + "\\)$"
35
+ );
36
+ const RE_LCH = new RegExp(
37
+ "^lch\\(" + RE_S + [FLOAT_OR_PCT, FLOAT_OR_PCT, ANLGE].join(SEP) + ALPHA + "\\)$"
38
+ );
39
+ const RE_OKLAB = new RegExp(
40
+ "^oklab\\(" + RE_S + [FLOAT_OR_PCT, FLOAT_OR_PCT, FLOAT_OR_PCT].join(SEP) + ALPHA + "\\)$"
41
+ );
42
+ const RE_OKLCH = new RegExp(
43
+ "^oklch\\(" + RE_S + [FLOAT_OR_PCT, FLOAT_OR_PCT, ANLGE].join(SEP) + ALPHA + "\\)$"
44
+ );
45
+ const { round } = Math;
46
+ const roundRGB = (rgb) => {
47
+ return rgb.map((v, i) => i <= 2 ? limit(round(v), 0, 255) : v);
48
+ };
49
+ const percentToAbsolute = (pct, min = 0, max = 100, signed = false) => {
50
+ if (typeof pct === "string" && pct.endsWith("%")) {
51
+ pct = parseFloat(pct.substring(0, pct.length - 1)) / 100;
52
+ if (signed) {
53
+ pct = min + (pct + 1) * 0.5 * (max - min);
54
+ } else {
55
+ pct = min + pct * (max - min);
56
+ }
57
+ }
58
+ return +pct;
59
+ };
60
+ const noneToValue = (v, noneValue) => {
61
+ return v === "none" ? noneValue : v;
62
+ };
63
+ const css2rgb = (css) => {
64
+ css = css.toLowerCase().trim();
65
+ if (css === "transparent") {
66
+ return [0, 0, 0, 0];
67
+ }
68
+ let m;
69
+ if (input.format.named) {
70
+ try {
71
+ return input.format.named(css);
72
+ } catch (e) {
73
+ }
74
+ }
75
+ if ((m = css.match(RE_RGB)) || (m = css.match(RE_RGB_LEGACY))) {
76
+ let rgb = m.slice(1, 4);
77
+ for (let i = 0; i < 3; i++) {
78
+ rgb[i] = +percentToAbsolute(noneToValue(rgb[i], 0), 0, 255);
79
+ }
80
+ rgb = roundRGB(rgb);
81
+ const alpha = m[4] !== void 0 ? +percentToAbsolute(m[4], 0, 1) : 1;
82
+ rgb[3] = alpha;
83
+ return rgb;
84
+ }
85
+ if (m = css.match(RE_RGBA_LEGACY)) {
86
+ const rgb = m.slice(1, 5);
87
+ for (let i = 0; i < 4; i++) {
88
+ rgb[i] = +percentToAbsolute(rgb[i], 0, 255);
89
+ }
90
+ return rgb;
91
+ }
92
+ if ((m = css.match(RE_HSL)) || (m = css.match(RE_HSL_LEGACY))) {
93
+ const hsl = m.slice(1, 4);
94
+ hsl[0] = +noneToValue(hsl[0].replace("deg", ""), 0);
95
+ hsl[1] = +percentToAbsolute(noneToValue(hsl[1], 0), 0, 100) * 0.01;
96
+ hsl[2] = +percentToAbsolute(noneToValue(hsl[2], 0), 0, 100) * 0.01;
97
+ const rgb = roundRGB(hsl2rgb(hsl));
98
+ const alpha = m[4] !== void 0 ? +percentToAbsolute(m[4], 0, 1) : 1;
99
+ rgb[3] = alpha;
100
+ return rgb;
101
+ }
102
+ if (m = css.match(RE_HSLA_LEGACY)) {
103
+ const hsl = m.slice(1, 4);
104
+ hsl[1] *= 0.01;
105
+ hsl[2] *= 0.01;
106
+ const rgb = hsl2rgb(hsl);
107
+ for (let i = 0; i < 3; i++) {
108
+ rgb[i] = round(rgb[i]);
109
+ }
110
+ rgb[3] = +m[4];
111
+ return rgb;
112
+ }
113
+ if (m = css.match(RE_LAB)) {
114
+ const lab = m.slice(1, 4);
115
+ lab[0] = percentToAbsolute(noneToValue(lab[0], 0), 0, 100);
116
+ lab[1] = percentToAbsolute(noneToValue(lab[1], 0), -125, 125, true);
117
+ lab[2] = percentToAbsolute(noneToValue(lab[2], 0), -125, 125, true);
118
+ const wp = getLabWhitePoint();
119
+ setLabWhitePoint("d50");
120
+ const rgb = roundRGB(lab2rgb(lab));
121
+ setLabWhitePoint(wp);
122
+ const alpha = m[4] !== void 0 ? +percentToAbsolute(m[4], 0, 1) : 1;
123
+ rgb[3] = alpha;
124
+ return rgb;
125
+ }
126
+ if (m = css.match(RE_LCH)) {
127
+ const lch = m.slice(1, 4);
128
+ lch[0] = percentToAbsolute(lch[0], 0, 100);
129
+ lch[1] = percentToAbsolute(noneToValue(lch[1], 0), 0, 150, false);
130
+ lch[2] = +noneToValue(lch[2].replace("deg", ""), 0);
131
+ const wp = getLabWhitePoint();
132
+ setLabWhitePoint("d50");
133
+ const rgb = roundRGB(lch2rgb(lch));
134
+ setLabWhitePoint(wp);
135
+ const alpha = m[4] !== void 0 ? +percentToAbsolute(m[4], 0, 1) : 1;
136
+ rgb[3] = alpha;
137
+ return rgb;
138
+ }
139
+ if (m = css.match(RE_OKLAB)) {
140
+ const oklab = m.slice(1, 4);
141
+ oklab[0] = percentToAbsolute(noneToValue(oklab[0], 0), 0, 1);
142
+ oklab[1] = percentToAbsolute(noneToValue(oklab[1], 0), -0.4, 0.4, true);
143
+ oklab[2] = percentToAbsolute(noneToValue(oklab[2], 0), -0.4, 0.4, true);
144
+ const rgb = roundRGB(oklab2rgb(oklab));
145
+ const alpha = m[4] !== void 0 ? +percentToAbsolute(m[4], 0, 1) : 1;
146
+ rgb[3] = alpha;
147
+ return rgb;
148
+ }
149
+ if (m = css.match(RE_OKLCH)) {
150
+ const oklch = m.slice(1, 4);
151
+ oklch[0] = percentToAbsolute(noneToValue(oklch[0], 0), 0, 1);
152
+ oklch[1] = percentToAbsolute(noneToValue(oklch[1], 0), 0, 0.4, false);
153
+ oklch[2] = +noneToValue(oklch[2].replace("deg", ""), 0);
154
+ const rgb = roundRGB(oklch2rgb(oklch));
155
+ const alpha = m[4] !== void 0 ? +percentToAbsolute(m[4], 0, 1) : 1;
156
+ rgb[3] = alpha;
157
+ return rgb;
158
+ }
159
+ };
160
+ css2rgb.test = (s) => {
161
+ return (
162
+ // modern
163
+ RE_RGB.test(s) || RE_HSL.test(s) || RE_LAB.test(s) || RE_LCH.test(s) || RE_OKLAB.test(s) || RE_OKLCH.test(s) || // legacy
164
+ RE_RGB_LEGACY.test(s) || RE_RGBA_LEGACY.test(s) || RE_HSL_LEGACY.test(s) || RE_HSLA_LEGACY.test(s) || s === "transparent"
165
+ );
166
+ };
167
+ export {
168
+ css2rgb as default
169
+ };
@@ -0,0 +1,20 @@
1
+ import { rnd2 } from "../../utils/index.js";
2
+ import unpack from "../../utils/unpack.js";
3
+ import last from "../../utils/last.js";
4
+ const hsl2css = (...args) => {
5
+ const hsla = unpack(args, "hsla");
6
+ let mode = last(args) || "lsa";
7
+ hsla[0] = rnd2(hsla[0] || 0) + "deg";
8
+ hsla[1] = rnd2(hsla[1] * 100) + "%";
9
+ hsla[2] = rnd2(hsla[2] * 100) + "%";
10
+ if (mode === "hsla" || hsla.length > 3 && hsla[3] < 1) {
11
+ hsla[3] = "/ " + (hsla.length > 3 ? hsla[3] : 1);
12
+ mode = "hsla";
13
+ } else {
14
+ hsla.length = 3;
15
+ }
16
+ return `${mode.substr(0, 3)}(${hsla.join(" ")})`;
17
+ };
18
+ export {
19
+ hsl2css as default
20
+ };
@@ -0,0 +1,23 @@
1
+ import chroma from "../../chroma.js";
2
+ import Color from "../../Color.js";
3
+ import input from "../input.js";
4
+ import type from "../../utils/type.js";
5
+ import rgb2css from "./rgb2css.js";
6
+ import css2rgb from "./css2rgb.js";
7
+ Color.prototype.css = function(mode) {
8
+ return rgb2css(this._rgb, mode);
9
+ };
10
+ const css = (...args) => new Color(...args, "css");
11
+ chroma.css = css;
12
+ input.format.css = css2rgb;
13
+ input.autodetect.push({
14
+ p: 5,
15
+ test: (h, ...rest) => {
16
+ if (!rest.length && type(h) === "string" && css2rgb.test(h)) {
17
+ return "css";
18
+ }
19
+ }
20
+ });
21
+ export {
22
+ css
23
+ };
@@ -0,0 +1,19 @@
1
+ import { rnd2 } from "../../utils/index.js";
2
+ import unpack from "../../utils/unpack.js";
3
+ import last from "../../utils/last.js";
4
+ const lab2css = (...args) => {
5
+ const laba = unpack(args, "lab");
6
+ let mode = last(args) || "lab";
7
+ laba[0] = rnd2(laba[0]) + "%";
8
+ laba[1] = rnd2(laba[1]);
9
+ laba[2] = rnd2(laba[2]);
10
+ if (mode === "laba" || laba.length > 3 && laba[3] < 1) {
11
+ laba[3] = "/ " + (laba.length > 3 ? laba[3] : 1);
12
+ } else {
13
+ laba.length = 3;
14
+ }
15
+ return `lab(${laba.join(" ")})`;
16
+ };
17
+ export {
18
+ lab2css as default
19
+ };
@@ -0,0 +1,19 @@
1
+ import { rnd2 } from "../../utils/index.js";
2
+ import unpack from "../../utils/unpack.js";
3
+ import last from "../../utils/last.js";
4
+ const lch2css = (...args) => {
5
+ const lcha = unpack(args, "lch");
6
+ let mode = last(args) || "lab";
7
+ lcha[0] = rnd2(lcha[0]) + "%";
8
+ lcha[1] = rnd2(lcha[1]);
9
+ lcha[2] = isNaN(lcha[2]) ? "none" : rnd2(lcha[2]) + "deg";
10
+ if (mode === "lcha" || lcha.length > 3 && lcha[3] < 1) {
11
+ lcha[3] = "/ " + (lcha.length > 3 ? lcha[3] : 1);
12
+ } else {
13
+ lcha.length = 3;
14
+ }
15
+ return `lch(${lcha.join(" ")})`;
16
+ };
17
+ export {
18
+ lch2css as default
19
+ };
@@ -0,0 +1,17 @@
1
+ import { rnd2, rnd3 } from "../../utils/index.js";
2
+ import unpack from "../../utils/unpack.js";
3
+ const oklab2css = (...args) => {
4
+ const laba = unpack(args, "lab");
5
+ laba[0] = rnd2(laba[0] * 100) + "%";
6
+ laba[1] = rnd3(laba[1]);
7
+ laba[2] = rnd3(laba[2]);
8
+ if (laba.length > 3 && laba[3] < 1) {
9
+ laba[3] = "/ " + (laba.length > 3 ? laba[3] : 1);
10
+ } else {
11
+ laba.length = 3;
12
+ }
13
+ return `oklab(${laba.join(" ")})`;
14
+ };
15
+ export {
16
+ oklab2css as default
17
+ };
@@ -0,0 +1,17 @@
1
+ import { rnd2, rnd3 } from "../../utils/index.js";
2
+ import unpack from "../../utils/unpack.js";
3
+ const oklch2css = (...args) => {
4
+ const lcha = unpack(args, "lch");
5
+ lcha[0] = rnd2(lcha[0] * 100) + "%";
6
+ lcha[1] = rnd3(lcha[1]);
7
+ lcha[2] = isNaN(lcha[2]) ? "none" : rnd2(lcha[2]) + "deg";
8
+ if (lcha.length > 3 && lcha[3] < 1) {
9
+ lcha[3] = "/ " + (lcha.length > 3 ? lcha[3] : 1);
10
+ } else {
11
+ lcha.length = 3;
12
+ }
13
+ return `oklch(${lcha.join(" ")})`;
14
+ };
15
+ export {
16
+ oklch2css as default
17
+ };
@@ -0,0 +1,53 @@
1
+ import "../../utils/type.js";
2
+ import unpack from "../../utils/unpack.js";
3
+ import last from "../../utils/last.js";
4
+ import hsl2css from "./hsl2css.js";
5
+ import rgb2hsl from "../hsl/rgb2hsl.js";
6
+ import lab2css from "./lab2css.js";
7
+ import rgb2lab from "../lab/rgb2lab.js";
8
+ import lch2css from "./lch2css.js";
9
+ import rgb2lch from "../lch/rgb2lch.js";
10
+ import rgb2oklab from "../oklab/rgb2oklab.js";
11
+ import oklab2css from "./oklab2css.js";
12
+ import rgb2oklch from "../oklch/rgb2oklch.js";
13
+ import oklch2css from "./oklch2css.js";
14
+ import { setLabWhitePoint, getLabWhitePoint } from "../lab/lab-constants.js";
15
+ const { round } = Math;
16
+ const rgb2css = (...args) => {
17
+ const rgba = unpack(args, "rgba");
18
+ let mode = last(args) || "rgb";
19
+ if (mode.substr(0, 3) === "hsl") {
20
+ return hsl2css(rgb2hsl(rgba), mode);
21
+ }
22
+ if (mode.substr(0, 3) === "lab") {
23
+ const prevWhitePoint = getLabWhitePoint();
24
+ setLabWhitePoint("d50");
25
+ const cssColor = lab2css(rgb2lab(rgba), mode);
26
+ setLabWhitePoint(prevWhitePoint);
27
+ return cssColor;
28
+ }
29
+ if (mode.substr(0, 3) === "lch") {
30
+ const prevWhitePoint = getLabWhitePoint();
31
+ setLabWhitePoint("d50");
32
+ const cssColor = lch2css(rgb2lch(rgba), mode);
33
+ setLabWhitePoint(prevWhitePoint);
34
+ return cssColor;
35
+ }
36
+ if (mode.substr(0, 5) === "oklab") {
37
+ return oklab2css(rgb2oklab(rgba));
38
+ }
39
+ if (mode.substr(0, 5) === "oklch") {
40
+ return oklch2css(rgb2oklch(rgba));
41
+ }
42
+ rgba[0] = round(rgba[0]);
43
+ rgba[1] = round(rgba[1]);
44
+ rgba[2] = round(rgba[2]);
45
+ if (mode === "rgba" || rgba.length > 3 && rgba[3] < 1) {
46
+ rgba[3] = "/ " + (rgba.length > 3 ? rgba[3] : 1);
47
+ mode = "rgba";
48
+ }
49
+ return `${mode.substr(0, 3)}(${rgba.slice(0, mode === "rgb" ? 3 : 4).join(" ")})`;
50
+ };
51
+ export {
52
+ rgb2css as default
53
+ };
@@ -0,0 +1,21 @@
1
+ import Color from "../../Color.js";
2
+ import chroma from "../../chroma.js";
3
+ import input from "../input.js";
4
+ import "../../utils/type.js";
5
+ import unpack from "../../utils/unpack.js";
6
+ input.format.gl = (...args) => {
7
+ const rgb = unpack(args, "rgba");
8
+ rgb[0] *= 255;
9
+ rgb[1] *= 255;
10
+ rgb[2] *= 255;
11
+ return rgb;
12
+ };
13
+ const gl = (...args) => new Color(...args, "gl");
14
+ chroma.gl = gl;
15
+ Color.prototype.gl = function() {
16
+ const rgb = this._rgb;
17
+ return [rgb[0] / 255, rgb[1] / 255, rgb[2] / 255, rgb[3]];
18
+ };
19
+ export {
20
+ gl
21
+ };
@@ -0,0 +1,48 @@
1
+ import "../../utils/type.js";
2
+ import unpack from "../../utils/unpack.js";
3
+ const { floor } = Math;
4
+ const hcg2rgb = (...args) => {
5
+ args = unpack(args, "hcg");
6
+ let [h, c, _g] = args;
7
+ let r, g, b;
8
+ _g = _g * 255;
9
+ const _c = c * 255;
10
+ if (c === 0) {
11
+ r = g = b = _g;
12
+ } else {
13
+ if (h === 360) h = 0;
14
+ if (h > 360) h -= 360;
15
+ if (h < 0) h += 360;
16
+ h /= 60;
17
+ const i = floor(h);
18
+ const f = h - i;
19
+ const p = _g * (1 - c);
20
+ const q = p + _c * (1 - f);
21
+ const t = p + _c * f;
22
+ const v = p + _c;
23
+ switch (i) {
24
+ case 0:
25
+ [r, g, b] = [v, t, p];
26
+ break;
27
+ case 1:
28
+ [r, g, b] = [q, v, p];
29
+ break;
30
+ case 2:
31
+ [r, g, b] = [p, v, t];
32
+ break;
33
+ case 3:
34
+ [r, g, b] = [p, q, v];
35
+ break;
36
+ case 4:
37
+ [r, g, b] = [t, p, v];
38
+ break;
39
+ case 5:
40
+ [r, g, b] = [v, p, q];
41
+ break;
42
+ }
43
+ }
44
+ return [r, g, b, args.length > 3 ? args[3] : 1];
45
+ };
46
+ export {
47
+ hcg2rgb as default
48
+ };
@@ -0,0 +1,25 @@
1
+ import type from "../../utils/type.js";
2
+ import unpack from "../../utils/unpack.js";
3
+ import chroma from "../../chroma.js";
4
+ import Color from "../../Color.js";
5
+ import input from "../input.js";
6
+ import hcg2rgb from "./hcg2rgb.js";
7
+ import rgb2hcg from "./rgb2hcg.js";
8
+ Color.prototype.hcg = function() {
9
+ return rgb2hcg(this._rgb);
10
+ };
11
+ const hcg = (...args) => new Color(...args, "hcg");
12
+ chroma.hcg = hcg;
13
+ input.format.hcg = hcg2rgb;
14
+ input.autodetect.push({
15
+ p: 1,
16
+ test: (...args) => {
17
+ args = unpack(args, "hcg");
18
+ if (type(args) === "array" && args.length === 3) {
19
+ return "hcg";
20
+ }
21
+ }
22
+ });
23
+ export {
24
+ hcg
25
+ };
@@ -0,0 +1,24 @@
1
+ import { min, max } from "../../utils/index.js";
2
+ import unpack from "../../utils/unpack.js";
3
+ const rgb2hcg = (...args) => {
4
+ const [r, g, b] = unpack(args, "rgb");
5
+ const minRgb = min(r, g, b);
6
+ const maxRgb = max(r, g, b);
7
+ const delta = maxRgb - minRgb;
8
+ const c = delta * 100 / 255;
9
+ const _g = minRgb / (255 - delta) * 100;
10
+ let h;
11
+ if (delta === 0) {
12
+ h = Number.NaN;
13
+ } else {
14
+ if (r === maxRgb) h = (g - b) / delta;
15
+ if (g === maxRgb) h = 2 + (b - r) / delta;
16
+ if (b === maxRgb) h = 4 + (r - g) / delta;
17
+ h *= 60;
18
+ if (h < 0) h += 360;
19
+ }
20
+ return [h, c, _g];
21
+ };
22
+ export {
23
+ rgb2hcg as default
24
+ };
@@ -0,0 +1,37 @@
1
+ const RE_HEX = /^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
2
+ const RE_HEXA = /^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/;
3
+ const hex2rgb = (hex) => {
4
+ if (hex.match(RE_HEX)) {
5
+ if (hex.length === 4 || hex.length === 7) {
6
+ hex = hex.substr(1);
7
+ }
8
+ if (hex.length === 3) {
9
+ hex = hex.split("");
10
+ hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
11
+ }
12
+ const u = parseInt(hex, 16);
13
+ const r = u >> 16;
14
+ const g = u >> 8 & 255;
15
+ const b = u & 255;
16
+ return [r, g, b, 1];
17
+ }
18
+ if (hex.match(RE_HEXA)) {
19
+ if (hex.length === 5 || hex.length === 9) {
20
+ hex = hex.substr(1);
21
+ }
22
+ if (hex.length === 4) {
23
+ hex = hex.split("");
24
+ hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2] + hex[3] + hex[3];
25
+ }
26
+ const u = parseInt(hex, 16);
27
+ const r = u >> 24 & 255;
28
+ const g = u >> 16 & 255;
29
+ const b = u >> 8 & 255;
30
+ const a = Math.round((u & 255) / 255 * 100) / 100;
31
+ return [r, g, b, a];
32
+ }
33
+ throw new Error(`unknown hex color: ${hex}`);
34
+ };
35
+ export {
36
+ hex2rgb as default
37
+ };
@@ -0,0 +1,23 @@
1
+ import Color from "../../Color.js";
2
+ import chroma from "../../chroma.js";
3
+ import type from "../../utils/type.js";
4
+ import input from "../input.js";
5
+ import hex2rgb from "./hex2rgb.js";
6
+ import rgb2hex from "./rgb2hex.js";
7
+ Color.prototype.hex = function(mode) {
8
+ return rgb2hex(this._rgb, mode);
9
+ };
10
+ const hex = (...args) => new Color(...args, "hex");
11
+ chroma.hex = hex;
12
+ input.format.hex = hex2rgb;
13
+ input.autodetect.push({
14
+ p: 4,
15
+ test: (h, ...rest) => {
16
+ if (!rest.length && type(h) === "string" && [3, 4, 5, 6, 7, 8, 9].indexOf(h.length) >= 0) {
17
+ return "hex";
18
+ }
19
+ }
20
+ });
21
+ export {
22
+ hex
23
+ };