@choice-ui/react 1.7.6 → 1.7.7

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 (308) 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/index.d.ts +1 -0
  198. package/dist/components/textarea/src/tv.d.ts +9 -3
  199. package/dist/components/textarea/src/tv.js +3 -1
  200. package/dist/components/toggle-button/dist/index.js +602 -0
  201. package/dist/index.js +69 -0
  202. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/index.js +119 -0
  203. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/Color.js +42 -0
  204. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/chroma.js +9 -0
  205. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/colors/colorbrewer.js +57 -0
  206. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/colors/w3cx11.js +159 -0
  207. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/average.js +82 -0
  208. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/bezier.js +68 -0
  209. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/blend.js +43 -0
  210. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/cubehelix.js +81 -0
  211. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/mix.js +20 -0
  212. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/random.js +13 -0
  213. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/scale.js +325 -0
  214. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/_hsx.js +54 -0
  215. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/hcg.js +10 -0
  216. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/hsi.js +10 -0
  217. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/hsl.js +10 -0
  218. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/hsv.js +10 -0
  219. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/index.js +4 -0
  220. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/lab.js +17 -0
  221. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/lch.js +11 -0
  222. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/lrgb.js +17 -0
  223. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/num.js +12 -0
  224. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/oklab.js +17 -0
  225. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/oklch.js +10 -0
  226. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/rgb.js +16 -0
  227. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/cmyk/cmyk2rgb.js +20 -0
  228. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/cmyk/index.js +25 -0
  229. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/cmyk/rgb2cmyk.js +18 -0
  230. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/css2rgb.js +169 -0
  231. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/hsl2css.js +20 -0
  232. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/index.js +23 -0
  233. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/lab2css.js +19 -0
  234. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/lch2css.js +19 -0
  235. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/oklab2css.js +17 -0
  236. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/oklch2css.js +17 -0
  237. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/rgb2css.js +53 -0
  238. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/gl/index.js +21 -0
  239. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hcg/hcg2rgb.js +48 -0
  240. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hcg/index.js +25 -0
  241. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hcg/rgb2hcg.js +24 -0
  242. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hex/hex2rgb.js +37 -0
  243. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hex/index.js +23 -0
  244. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hex/rgb2hex.js +31 -0
  245. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsi/hsi2rgb.js +36 -0
  246. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsi/index.js +25 -0
  247. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsi/rgb2hsi.js +28 -0
  248. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsl/hsl2rgb.js +35 -0
  249. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsl/index.js +25 -0
  250. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsl/rgb2hsl.js +29 -0
  251. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsv/hsv2rgb.js +46 -0
  252. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsv/index.js +25 -0
  253. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsv/rgb2hsv.js +27 -0
  254. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/input.js +7 -0
  255. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lab/index.js +28 -0
  256. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lab/lab-constants.js +106 -0
  257. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lab/lab2rgb.js +59 -0
  258. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lab/rgb2lab.js +51 -0
  259. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/hcl2rgb.js +10 -0
  260. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/index.js +35 -0
  261. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/lab2lch.js +13 -0
  262. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/lch2lab.js +12 -0
  263. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/lch2rgb.js +14 -0
  264. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/rgb2lch.js +13 -0
  265. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/named/index.js +26 -0
  266. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/num/index.js +23 -0
  267. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/num/num2rgb.js +13 -0
  268. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/num/rgb2num.js +9 -0
  269. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklab/index.js +25 -0
  270. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklab/oklab2rgb.js +31 -0
  271. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklab/rgb2oklab.js +30 -0
  272. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklch/index.js +25 -0
  273. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklch/oklch2rgb.js +14 -0
  274. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklch/rgb2oklch.js +13 -0
  275. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/rgb/index.js +34 -0
  276. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/temp/index.js +16 -0
  277. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/temp/rgb2temperature.js +25 -0
  278. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/temp/temperature2rgb.js +18 -0
  279. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/alpha.js +12 -0
  280. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/clipped.js +4 -0
  281. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/darken.js +14 -0
  282. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/get.js +12 -0
  283. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/luminance.js +38 -0
  284. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/mix.js +5 -0
  285. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/premultiply.js +11 -0
  286. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/saturate.js +13 -0
  287. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/set.js +42 -0
  288. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/shade.js +9 -0
  289. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/analyze.js +161 -0
  290. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/clip_rgb.js +17 -0
  291. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/contrast.js +12 -0
  292. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/contrastAPCA.js +43 -0
  293. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/delta-e.js +48 -0
  294. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/distance.js +16 -0
  295. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/index.js +24 -0
  296. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/last.js +10 -0
  297. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/limit.js +7 -0
  298. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/multiply-matrices.js +29 -0
  299. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/scales.js +16 -0
  300. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/type.js +20 -0
  301. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/unpack.js +11 -0
  302. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/valid.js +12 -0
  303. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/version.js +4 -0
  304. package/dist/node_modules/.pnpm/fuse.js@7.1.0/node_modules/fuse.js/dist/fuse.js +1317 -0
  305. package/dist/styles/components.css +40 -0
  306. package/dist/tailwind.css +1 -0
  307. package/package.json +32 -20
  308. package/dist/components/virtual-select/dist/index.d.ts +0 -48
@@ -0,0 +1,26 @@
1
+ import Color from "../../Color.js";
2
+ import input from "../input.js";
3
+ import type from "../../utils/type.js";
4
+ import w3cx11 from "../../colors/w3cx11.js";
5
+ import hex2rgb from "../hex/hex2rgb.js";
6
+ import rgb2hex from "../hex/rgb2hex.js";
7
+ Color.prototype.name = function() {
8
+ const hex = rgb2hex(this._rgb, "rgb");
9
+ for (let n of Object.keys(w3cx11)) {
10
+ if (w3cx11[n] === hex) return n.toLowerCase();
11
+ }
12
+ return hex;
13
+ };
14
+ input.format.named = (name) => {
15
+ name = name.toLowerCase();
16
+ if (w3cx11[name]) return hex2rgb(w3cx11[name]);
17
+ throw new Error("unknown color name: " + name);
18
+ };
19
+ input.autodetect.push({
20
+ p: 5,
21
+ test: (h, ...rest) => {
22
+ if (!rest.length && type(h) === "string" && w3cx11[h.toLowerCase()]) {
23
+ return "named";
24
+ }
25
+ }
26
+ });
@@ -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 num2rgb from "./num2rgb.js";
6
+ import rgb2num from "./rgb2num.js";
7
+ Color.prototype.num = function() {
8
+ return rgb2num(this._rgb);
9
+ };
10
+ const num = (...args) => new Color(...args, "num");
11
+ Object.assign(chroma, { num });
12
+ input.format.num = num2rgb;
13
+ input.autodetect.push({
14
+ p: 5,
15
+ test: (...args) => {
16
+ if (args.length === 1 && type(args[0]) === "number" && args[0] >= 0 && args[0] <= 16777215) {
17
+ return "num";
18
+ }
19
+ }
20
+ });
21
+ export {
22
+ num
23
+ };
@@ -0,0 +1,13 @@
1
+ import type from "../../utils/type.js";
2
+ const num2rgb = (num) => {
3
+ if (type(num) == "number" && num >= 0 && num <= 16777215) {
4
+ const r = num >> 16;
5
+ const g = num >> 8 & 255;
6
+ const b = num & 255;
7
+ return [r, g, b, 1];
8
+ }
9
+ throw new Error("unknown num color: " + num);
10
+ };
11
+ export {
12
+ num2rgb as default
13
+ };
@@ -0,0 +1,9 @@
1
+ import "../../utils/type.js";
2
+ import unpack from "../../utils/unpack.js";
3
+ const rgb2num = (...args) => {
4
+ const [r, g, b] = unpack(args, "rgb");
5
+ return (r << 16) + (g << 8) + b;
6
+ };
7
+ export {
8
+ rgb2num as default
9
+ };
@@ -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 oklab2rgb from "./oklab2rgb.js";
7
+ import rgb2oklab from "./rgb2oklab.js";
8
+ Color.prototype.oklab = function() {
9
+ return rgb2oklab(this._rgb);
10
+ };
11
+ const oklab = (...args) => new Color(...args, "oklab");
12
+ Object.assign(chroma, { oklab });
13
+ input.format.oklab = oklab2rgb;
14
+ input.autodetect.push({
15
+ p: 2,
16
+ test: (...args) => {
17
+ args = unpack(args, "oklab");
18
+ if (type(args) === "array" && args.length === 3) {
19
+ return "oklab";
20
+ }
21
+ }
22
+ });
23
+ export {
24
+ oklab
25
+ };
@@ -0,0 +1,31 @@
1
+ import "../../utils/type.js";
2
+ import unpack from "../../utils/unpack.js";
3
+ import multiplyMatrices from "../../utils/multiply-matrices.js";
4
+ import { xyz2rgb } from "../lab/lab2rgb.js";
5
+ const oklab2rgb = (...args) => {
6
+ args = unpack(args, "lab");
7
+ const [L, a, b, ...rest] = args;
8
+ const [X, Y, Z] = OKLab_to_XYZ([L, a, b]);
9
+ const [r, g, b_] = xyz2rgb(X, Y, Z);
10
+ return [r, g, b_, ...rest.length > 0 && rest[0] < 1 ? [rest[0]] : []];
11
+ };
12
+ function OKLab_to_XYZ(OKLab) {
13
+ var LMStoXYZ = [
14
+ [1.2268798758459243, -0.5578149944602171, 0.2813910456659647],
15
+ [-0.0405757452148008, 1.112286803280317, -0.0717110580655164],
16
+ [-0.0763729366746601, -0.4214933324022432, 1.5869240198367816]
17
+ ];
18
+ var OKLabtoLMS = [
19
+ [1, 0.3963377773761749, 0.2158037573099136],
20
+ [1, -0.1055613458156586, -0.0638541728258133],
21
+ [1, -0.0894841775298119, -1.2914855480194092]
22
+ ];
23
+ var LMSnl = multiplyMatrices(OKLabtoLMS, OKLab);
24
+ return multiplyMatrices(
25
+ LMStoXYZ,
26
+ LMSnl.map((c) => c ** 3)
27
+ );
28
+ }
29
+ export {
30
+ oklab2rgb as default
31
+ };
@@ -0,0 +1,30 @@
1
+ import "../../utils/type.js";
2
+ import unpack from "../../utils/unpack.js";
3
+ import multiplyMatrices from "../../utils/multiply-matrices.js";
4
+ import { rgb2xyz } from "../lab/rgb2lab.js";
5
+ const rgb2oklab = (...args) => {
6
+ const [r, g, b, ...rest] = unpack(args, "rgb");
7
+ const xyz = rgb2xyz(r, g, b);
8
+ const oklab = XYZ_to_OKLab(xyz);
9
+ return [...oklab, ...rest.length > 0 && rest[0] < 1 ? [rest[0]] : []];
10
+ };
11
+ function XYZ_to_OKLab(XYZ) {
12
+ const XYZtoLMS = [
13
+ [0.819022437996703, 0.3619062600528904, -0.1288737815209879],
14
+ [0.0329836539323885, 0.9292868615863434, 0.0361446663506424],
15
+ [0.0481771893596242, 0.2642395317527308, 0.6335478284694309]
16
+ ];
17
+ const LMStoOKLab = [
18
+ [0.210454268309314, 0.7936177747023054, -0.0040720430116193],
19
+ [1.9779985324311684, -2.42859224204858, 0.450593709617411],
20
+ [0.0259040424655478, 0.7827717124575296, -0.8086757549230774]
21
+ ];
22
+ const LMS = multiplyMatrices(XYZtoLMS, XYZ);
23
+ return multiplyMatrices(
24
+ LMStoOKLab,
25
+ LMS.map((c) => Math.cbrt(c))
26
+ );
27
+ }
28
+ export {
29
+ rgb2oklab as default
30
+ };
@@ -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 oklch2rgb from "./oklch2rgb.js";
7
+ import rgb2oklch from "./rgb2oklch.js";
8
+ Color.prototype.oklch = function() {
9
+ return rgb2oklch(this._rgb);
10
+ };
11
+ const oklch = (...args) => new Color(...args, "oklch");
12
+ Object.assign(chroma, { oklch });
13
+ input.format.oklch = oklch2rgb;
14
+ input.autodetect.push({
15
+ p: 2,
16
+ test: (...args) => {
17
+ args = unpack(args, "oklch");
18
+ if (type(args) === "array" && args.length === 3) {
19
+ return "oklch";
20
+ }
21
+ }
22
+ });
23
+ export {
24
+ oklch
25
+ };
@@ -0,0 +1,14 @@
1
+ import "../../utils/type.js";
2
+ import unpack from "../../utils/unpack.js";
3
+ import lch2lab from "../lch/lch2lab.js";
4
+ import oklab2rgb from "../oklab/oklab2rgb.js";
5
+ const oklch2rgb = (...args) => {
6
+ args = unpack(args, "lch");
7
+ const [l, c, h, ...rest] = args;
8
+ const [L, a, b_] = lch2lab(l, c, h);
9
+ const [r, g, b] = oklab2rgb(L, a, b_);
10
+ return [r, g, b, ...rest.length > 0 && rest[0] < 1 ? [rest[0]] : []];
11
+ };
12
+ export {
13
+ oklch2rgb as default
14
+ };
@@ -0,0 +1,13 @@
1
+ import "../../utils/type.js";
2
+ import unpack from "../../utils/unpack.js";
3
+ import rgb2oklab from "../oklab/rgb2oklab.js";
4
+ import lab2lch from "../lch/lab2lch.js";
5
+ const rgb2oklch = (...args) => {
6
+ const [r, g, b, ...rest] = unpack(args, "rgb");
7
+ const [l, a, b_] = rgb2oklab(r, g, b);
8
+ const [L, c, h] = lab2lch(l, a, b_);
9
+ return [L, c, h, ...rest.length > 0 && rest[0] < 1 ? [rest[0]] : []];
10
+ };
11
+ export {
12
+ rgb2oklch as default
13
+ };
@@ -0,0 +1,34 @@
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
+ const { round } = Math;
7
+ Color.prototype.rgb = function(rnd = true) {
8
+ if (rnd === false) return this._rgb.slice(0, 3);
9
+ return this._rgb.slice(0, 3).map(round);
10
+ };
11
+ Color.prototype.rgba = function(rnd = true) {
12
+ return this._rgb.slice(0, 4).map((v, i) => {
13
+ return i < 3 ? rnd === false ? v : round(v) : v;
14
+ });
15
+ };
16
+ const rgb = (...args) => new Color(...args, "rgb");
17
+ Object.assign(chroma, { rgb });
18
+ input.format.rgb = (...args) => {
19
+ const rgba = unpack(args, "rgba");
20
+ if (rgba[3] === void 0) rgba[3] = 1;
21
+ return rgba;
22
+ };
23
+ input.autodetect.push({
24
+ p: 3,
25
+ test: (...args) => {
26
+ args = unpack(args, "rgba");
27
+ if (type(args) === "array" && (args.length === 3 || args.length === 4 && type(args[3]) == "number" && args[3] >= 0 && args[3] <= 1)) {
28
+ return "rgb";
29
+ }
30
+ }
31
+ });
32
+ export {
33
+ rgb
34
+ };
@@ -0,0 +1,16 @@
1
+ import chroma from "../../chroma.js";
2
+ import Color from "../../Color.js";
3
+ import input from "../input.js";
4
+ import temperature2rgb from "./temperature2rgb.js";
5
+ import rgb2temperature from "./rgb2temperature.js";
6
+ Color.prototype.temp = Color.prototype.kelvin = Color.prototype.temperature = function() {
7
+ return rgb2temperature(this._rgb);
8
+ };
9
+ const temp = (...args) => new Color(...args, "temp");
10
+ Object.assign(chroma, { temp, kelvin: temp, temperature: temp });
11
+ input.format.temp = input.format.kelvin = input.format.temperature = temperature2rgb;
12
+ export {
13
+ temp as kelvin,
14
+ temp,
15
+ temp as temperature
16
+ };
@@ -0,0 +1,25 @@
1
+ import temperature2rgb from "./temperature2rgb.js";
2
+ import "../../utils/type.js";
3
+ import unpack from "../../utils/unpack.js";
4
+ const { round } = Math;
5
+ const rgb2temperature = (...args) => {
6
+ const rgb = unpack(args, "rgb");
7
+ const r = rgb[0], b = rgb[2];
8
+ let minTemp = 1e3;
9
+ let maxTemp = 4e4;
10
+ const eps = 0.4;
11
+ let temp;
12
+ while (maxTemp - minTemp > eps) {
13
+ temp = (maxTemp + minTemp) * 0.5;
14
+ const rgb2 = temperature2rgb(temp);
15
+ if (rgb2[2] / rgb2[0] >= b / r) {
16
+ maxTemp = temp;
17
+ } else {
18
+ minTemp = temp;
19
+ }
20
+ }
21
+ return round(temp);
22
+ };
23
+ export {
24
+ rgb2temperature as default
25
+ };
@@ -0,0 +1,18 @@
1
+ const { log } = Math;
2
+ const temperature2rgb = (kelvin) => {
3
+ const temp = kelvin / 100;
4
+ let r, g, b;
5
+ if (temp < 66) {
6
+ r = 255;
7
+ g = temp < 6 ? 0 : -155.25485562709179 - 0.44596950469579133 * (g = temp - 2) + 104.49216199393888 * log(g);
8
+ b = temp < 20 ? 0 : -254.76935184120902 + 0.8274096064007395 * (b = temp - 10) + 115.67994401066147 * log(b);
9
+ } else {
10
+ r = 351.97690566805693 + 0.114206453784165 * (r = temp - 55) - 40.25366309332127 * log(r);
11
+ g = 325.4494125711974 + 0.07943456536662342 * (g = temp - 50) - 28.0852963507957 * log(g);
12
+ b = 255;
13
+ }
14
+ return [r, g, b, 1];
15
+ };
16
+ export {
17
+ temperature2rgb as default
18
+ };
@@ -0,0 +1,12 @@
1
+ import Color from "../Color.js";
2
+ import type from "../utils/type.js";
3
+ Color.prototype.alpha = function(a, mutate = false) {
4
+ if (a !== void 0 && type(a) === "number") {
5
+ if (mutate) {
6
+ this._rgb[3] = a;
7
+ return this;
8
+ }
9
+ return new Color([this._rgb[0], this._rgb[1], this._rgb[2], a], "rgb");
10
+ }
11
+ return this._rgb[3];
12
+ };
@@ -0,0 +1,4 @@
1
+ import Color from "../Color.js";
2
+ Color.prototype.clipped = function() {
3
+ return this._rgb._clipped || false;
4
+ };
@@ -0,0 +1,14 @@
1
+ import "../io/lab/index.js";
2
+ import Color from "../Color.js";
3
+ import labConstants from "../io/lab/lab-constants.js";
4
+ Color.prototype.darken = function(amount = 1) {
5
+ const me = this;
6
+ const lab = me.lab();
7
+ lab[0] -= labConstants.Kn * amount;
8
+ return new Color(lab, "lab").alpha(me.alpha(), true);
9
+ };
10
+ Color.prototype.brighten = function(amount = 1) {
11
+ return this.darken(-amount);
12
+ };
13
+ Color.prototype.darker = Color.prototype.darken;
14
+ Color.prototype.brighter = Color.prototype.brighten;
@@ -0,0 +1,12 @@
1
+ import Color from "../Color.js";
2
+ Color.prototype.get = function(mc) {
3
+ const [mode, channel] = mc.split(".");
4
+ const src = this[mode]();
5
+ if (channel) {
6
+ const i = mode.indexOf(channel) - (mode.substr(0, 2) === "ok" ? 2 : 0);
7
+ if (i > -1) return src[i];
8
+ throw new Error(`unknown channel ${channel} in mode ${mode}`);
9
+ } else {
10
+ return src;
11
+ }
12
+ };
@@ -0,0 +1,38 @@
1
+ import Color from "../Color.js";
2
+ import type from "../utils/type.js";
3
+ const { pow } = Math;
4
+ const EPS = 1e-7;
5
+ const MAX_ITER = 20;
6
+ Color.prototype.luminance = function(lum, mode = "rgb") {
7
+ if (lum !== void 0 && type(lum) === "number") {
8
+ if (lum === 0) {
9
+ return new Color([0, 0, 0, this._rgb[3]], "rgb");
10
+ }
11
+ if (lum === 1) {
12
+ return new Color([255, 255, 255, this._rgb[3]], "rgb");
13
+ }
14
+ let cur_lum = this.luminance();
15
+ let max_iter = MAX_ITER;
16
+ const test = (low, high) => {
17
+ const mid = low.interpolate(high, 0.5, mode);
18
+ const lm = mid.luminance();
19
+ if (Math.abs(lum - lm) < EPS || !max_iter--) {
20
+ return mid;
21
+ }
22
+ return lm > lum ? test(low, mid) : test(mid, high);
23
+ };
24
+ const rgb = (cur_lum > lum ? test(new Color([0, 0, 0]), this) : test(this, new Color([255, 255, 255]))).rgb();
25
+ return new Color([...rgb, this._rgb[3]]);
26
+ }
27
+ return rgb2luminance(...this._rgb.slice(0, 3));
28
+ };
29
+ const rgb2luminance = (r, g, b) => {
30
+ r = luminance_x(r);
31
+ g = luminance_x(g);
32
+ b = luminance_x(b);
33
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b;
34
+ };
35
+ const luminance_x = (x) => {
36
+ x /= 255;
37
+ return x <= 0.03928 ? x / 12.92 : pow((x + 0.055) / 1.055, 2.4);
38
+ };
@@ -0,0 +1,5 @@
1
+ import Color from "../Color.js";
2
+ import mix from "../generator/mix.js";
3
+ Color.prototype.mix = Color.prototype.interpolate = function(col2, f = 0.5, ...rest) {
4
+ return mix(this, col2, f, ...rest);
5
+ };
@@ -0,0 +1,11 @@
1
+ import Color from "../Color.js";
2
+ Color.prototype.premultiply = function(mutate = false) {
3
+ const rgb = this._rgb;
4
+ const a = rgb[3];
5
+ if (mutate) {
6
+ this._rgb = [rgb[0] * a, rgb[1] * a, rgb[2] * a, a];
7
+ return this;
8
+ } else {
9
+ return new Color([rgb[0] * a, rgb[1] * a, rgb[2] * a, a], "rgb");
10
+ }
11
+ };
@@ -0,0 +1,13 @@
1
+ import "../io/lch/index.js";
2
+ import Color from "../Color.js";
3
+ import labConstants from "../io/lab/lab-constants.js";
4
+ Color.prototype.saturate = function(amount = 1) {
5
+ const me = this;
6
+ const lch = me.lch();
7
+ lch[1] += labConstants.Kn * amount;
8
+ if (lch[1] < 0) lch[1] = 0;
9
+ return new Color(lch, "lch").alpha(me.alpha(), true);
10
+ };
11
+ Color.prototype.desaturate = function(amount = 1) {
12
+ return this.saturate(-amount);
13
+ };
@@ -0,0 +1,42 @@
1
+ import Color from "../Color.js";
2
+ import type from "../utils/type.js";
3
+ Color.prototype.set = function(mc, value, mutate = false) {
4
+ const [mode, channel] = mc.split(".");
5
+ const src = this[mode]();
6
+ if (channel) {
7
+ const i = mode.indexOf(channel) - (mode.substr(0, 2) === "ok" ? 2 : 0);
8
+ if (i > -1) {
9
+ if (type(value) == "string") {
10
+ switch (value.charAt(0)) {
11
+ case "+":
12
+ src[i] += +value;
13
+ break;
14
+ case "-":
15
+ src[i] += +value;
16
+ break;
17
+ case "*":
18
+ src[i] *= +value.substr(1);
19
+ break;
20
+ case "/":
21
+ src[i] /= +value.substr(1);
22
+ break;
23
+ default:
24
+ src[i] = +value;
25
+ }
26
+ } else if (type(value) === "number") {
27
+ src[i] = value;
28
+ } else {
29
+ throw new Error(`unsupported value for Color.set`);
30
+ }
31
+ const out = new Color(src, mode);
32
+ if (mutate) {
33
+ this._rgb = out._rgb;
34
+ return this;
35
+ }
36
+ return out;
37
+ }
38
+ throw new Error(`unknown channel ${channel} in mode ${mode}`);
39
+ } else {
40
+ return src;
41
+ }
42
+ };
@@ -0,0 +1,9 @@
1
+ import "../io/lab/index.js";
2
+ import Color from "../Color.js";
3
+ import mix from "../generator/mix.js";
4
+ Color.prototype.tint = function(f = 0.5, ...rest) {
5
+ return mix(this, "white", f, ...rest);
6
+ };
7
+ Color.prototype.shade = function(f = 0.5, ...rest) {
8
+ return mix(this, "black", f, ...rest);
9
+ };
@@ -0,0 +1,161 @@
1
+ import type from "./type.js";
2
+ const { log, pow, floor, abs } = Math;
3
+ function analyze(data, key = null) {
4
+ const r = {
5
+ min: Number.MAX_VALUE,
6
+ max: Number.MAX_VALUE * -1,
7
+ sum: 0,
8
+ values: [],
9
+ count: 0
10
+ };
11
+ if (type(data) === "object") {
12
+ data = Object.values(data);
13
+ }
14
+ data.forEach((val) => {
15
+ if (key && type(val) === "object") val = val[key];
16
+ if (val !== void 0 && val !== null && !isNaN(val)) {
17
+ r.values.push(val);
18
+ r.sum += val;
19
+ if (val < r.min) r.min = val;
20
+ if (val > r.max) r.max = val;
21
+ r.count += 1;
22
+ }
23
+ });
24
+ r.domain = [r.min, r.max];
25
+ r.limits = (mode, num) => limits(r, mode, num);
26
+ return r;
27
+ }
28
+ function limits(data, mode = "equal", num = 7) {
29
+ if (type(data) == "array") {
30
+ data = analyze(data);
31
+ }
32
+ const { min, max } = data;
33
+ const values = data.values.sort((a, b) => a - b);
34
+ if (num === 1) {
35
+ return [min, max];
36
+ }
37
+ const limits2 = [];
38
+ if (mode.substr(0, 1) === "c") {
39
+ limits2.push(min);
40
+ limits2.push(max);
41
+ }
42
+ if (mode.substr(0, 1) === "e") {
43
+ limits2.push(min);
44
+ for (let i = 1; i < num; i++) {
45
+ limits2.push(min + i / num * (max - min));
46
+ }
47
+ limits2.push(max);
48
+ } else if (mode.substr(0, 1) === "l") {
49
+ if (min <= 0) {
50
+ throw new Error(
51
+ "Logarithmic scales are only possible for values > 0"
52
+ );
53
+ }
54
+ const min_log = Math.LOG10E * log(min);
55
+ const max_log = Math.LOG10E * log(max);
56
+ limits2.push(min);
57
+ for (let i = 1; i < num; i++) {
58
+ limits2.push(pow(10, min_log + i / num * (max_log - min_log)));
59
+ }
60
+ limits2.push(max);
61
+ } else if (mode.substr(0, 1) === "q") {
62
+ limits2.push(min);
63
+ for (let i = 1; i < num; i++) {
64
+ const p = (values.length - 1) * i / num;
65
+ const pb = floor(p);
66
+ if (pb === p) {
67
+ limits2.push(values[pb]);
68
+ } else {
69
+ const pr = p - pb;
70
+ limits2.push(values[pb] * (1 - pr) + values[pb + 1] * pr);
71
+ }
72
+ }
73
+ limits2.push(max);
74
+ } else if (mode.substr(0, 1) === "k") {
75
+ let cluster;
76
+ const n = values.length;
77
+ const assignments = new Array(n);
78
+ const clusterSizes = new Array(num);
79
+ let repeat = true;
80
+ let nb_iters = 0;
81
+ let centroids = null;
82
+ centroids = [];
83
+ centroids.push(min);
84
+ for (let i = 1; i < num; i++) {
85
+ centroids.push(min + i / num * (max - min));
86
+ }
87
+ centroids.push(max);
88
+ while (repeat) {
89
+ for (let j = 0; j < num; j++) {
90
+ clusterSizes[j] = 0;
91
+ }
92
+ for (let i = 0; i < n; i++) {
93
+ const value = values[i];
94
+ let mindist = Number.MAX_VALUE;
95
+ let best;
96
+ for (let j = 0; j < num; j++) {
97
+ const dist = abs(centroids[j] - value);
98
+ if (dist < mindist) {
99
+ mindist = dist;
100
+ best = j;
101
+ }
102
+ clusterSizes[best]++;
103
+ assignments[i] = best;
104
+ }
105
+ }
106
+ const newCentroids = new Array(num);
107
+ for (let j = 0; j < num; j++) {
108
+ newCentroids[j] = null;
109
+ }
110
+ for (let i = 0; i < n; i++) {
111
+ cluster = assignments[i];
112
+ if (newCentroids[cluster] === null) {
113
+ newCentroids[cluster] = values[i];
114
+ } else {
115
+ newCentroids[cluster] += values[i];
116
+ }
117
+ }
118
+ for (let j = 0; j < num; j++) {
119
+ newCentroids[j] *= 1 / clusterSizes[j];
120
+ }
121
+ repeat = false;
122
+ for (let j = 0; j < num; j++) {
123
+ if (newCentroids[j] !== centroids[j]) {
124
+ repeat = true;
125
+ break;
126
+ }
127
+ }
128
+ centroids = newCentroids;
129
+ nb_iters++;
130
+ if (nb_iters > 200) {
131
+ repeat = false;
132
+ }
133
+ }
134
+ const kClusters = {};
135
+ for (let j = 0; j < num; j++) {
136
+ kClusters[j] = [];
137
+ }
138
+ for (let i = 0; i < n; i++) {
139
+ cluster = assignments[i];
140
+ kClusters[cluster].push(values[i]);
141
+ }
142
+ let tmpKMeansBreaks = [];
143
+ for (let j = 0; j < num; j++) {
144
+ tmpKMeansBreaks.push(kClusters[j][0]);
145
+ tmpKMeansBreaks.push(kClusters[j][kClusters[j].length - 1]);
146
+ }
147
+ tmpKMeansBreaks = tmpKMeansBreaks.sort((a, b) => a - b);
148
+ limits2.push(tmpKMeansBreaks[0]);
149
+ for (let i = 1; i < tmpKMeansBreaks.length; i += 2) {
150
+ const v = tmpKMeansBreaks[i];
151
+ if (!isNaN(v) && limits2.indexOf(v) === -1) {
152
+ limits2.push(v);
153
+ }
154
+ }
155
+ }
156
+ return limits2;
157
+ }
158
+ export {
159
+ analyze,
160
+ limits
161
+ };
@@ -0,0 +1,17 @@
1
+ import limit from "./limit.js";
2
+ const clip_rgb = (rgb) => {
3
+ rgb._clipped = false;
4
+ rgb._unclipped = rgb.slice(0);
5
+ for (let i = 0; i <= 3; i++) {
6
+ if (i < 3) {
7
+ if (rgb[i] < 0 || rgb[i] > 255) rgb._clipped = true;
8
+ rgb[i] = limit(rgb[i], 0, 255);
9
+ } else if (i === 3) {
10
+ rgb[i] = limit(rgb[i], 0, 1);
11
+ }
12
+ }
13
+ return rgb;
14
+ };
15
+ export {
16
+ clip_rgb as default
17
+ };