@solid2-aria/stately 0.0.0-stage → 0.0.1

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 (477) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +45 -2
  3. package/dist/LICENSES/Apache-2.0.txt +201 -0
  4. package/dist/LICENSES/react-spectrum-NOTICE.txt +242 -0
  5. package/dist/NOTICE.txt +636 -0
  6. package/dist/autocomplete/create-autocomplete-state.d.ts +46 -0
  7. package/dist/autocomplete/create-autocomplete-state.js +41 -0
  8. package/dist/autocomplete/create-autocomplete-state.js.map +1 -0
  9. package/dist/calendar/create-calendar-state.d.ts +62 -0
  10. package/dist/calendar/create-calendar-state.js +357 -0
  11. package/dist/calendar/create-calendar-state.js.map +1 -0
  12. package/dist/calendar/create-range-calendar-state.d.ts +63 -0
  13. package/dist/calendar/create-range-calendar-state.js +204 -0
  14. package/dist/calendar/create-range-calendar-state.js.map +1 -0
  15. package/dist/calendar/types.d.ts +222 -0
  16. package/dist/calendar/types.js +16 -0
  17. package/dist/calendar/utils.d.ts +27 -0
  18. package/dist/calendar/utils.js +81 -0
  19. package/dist/calendar/utils.js.map +1 -0
  20. package/dist/checkbox/create-checkbox-group-state.d.ts +60 -0
  21. package/dist/checkbox/create-checkbox-group-state.js +88 -0
  22. package/dist/checkbox/create-checkbox-group-state.js.map +1 -0
  23. package/dist/collections/collection-builder.d.ts +28 -0
  24. package/dist/collections/collection-builder.js +164 -0
  25. package/dist/collections/collection-builder.js.map +1 -0
  26. package/dist/collections/create-collection.d.ts +24 -0
  27. package/dist/collections/create-collection.js +35 -0
  28. package/dist/collections/create-collection.js.map +1 -0
  29. package/dist/collections/get-child-nodes.d.ts +25 -0
  30. package/dist/collections/get-child-nodes.js +67 -0
  31. package/dist/collections/get-child-nodes.js.map +1 -0
  32. package/dist/collections/get-item-count.d.ts +19 -0
  33. package/dist/collections/get-item-count.js +34 -0
  34. package/dist/collections/get-item-count.js.map +1 -0
  35. package/dist/collections/item.d.ts +29 -0
  36. package/dist/collections/item.js +68 -0
  37. package/dist/collections/item.js.map +1 -0
  38. package/dist/collections/section.d.ts +29 -0
  39. package/dist/collections/section.js +60 -0
  40. package/dist/collections/section.js.map +1 -0
  41. package/dist/collections/types.d.ts +46 -0
  42. package/dist/collections/types.js +29 -0
  43. package/dist/collections/types.js.map +1 -0
  44. package/dist/color/color/base-color.d.ts +40 -0
  45. package/dist/color/color/base-color.js +122 -0
  46. package/dist/color/color/base-color.js.map +1 -0
  47. package/dist/color/color/color-classes.d.ts +27 -0
  48. package/dist/color/color/color-classes.js +29 -0
  49. package/dist/color/color/color-classes.js.map +1 -0
  50. package/dist/color/color/color-constructors.d.ts +23 -0
  51. package/dist/color/color/color-constructors.js +16 -0
  52. package/dist/color/color/color.d.ts +3 -0
  53. package/dist/color/color/color.js +2 -0
  54. package/dist/color/color/hsb-color.d.ts +24 -0
  55. package/dist/color/color/hsb-color.js +183 -0
  56. package/dist/color/color/hsb-color.js.map +1 -0
  57. package/dist/color/color/hsl-color.d.ts +24 -0
  58. package/dist/color/color/hsl-color.js +184 -0
  59. package/dist/color/color/hsl-color.js.map +1 -0
  60. package/dist/color/color/normalize-hue.d.ts +18 -0
  61. package/dist/color/color/normalize-hue.js +24 -0
  62. package/dist/color/color/normalize-hue.js.map +1 -0
  63. package/dist/color/color/oklch.d.ts +19 -0
  64. package/dist/color/color/oklch.js +97 -0
  65. package/dist/color/color/oklch.js.map +1 -0
  66. package/dist/color/color/rgb-color.d.ts +24 -0
  67. package/dist/color/color/rgb-color.js +230 -0
  68. package/dist/color/color/rgb-color.js.map +1 -0
  69. package/dist/color/color.d.ts +25 -0
  70. package/dist/color/color.js +41 -0
  71. package/dist/color/color.js.map +1 -0
  72. package/dist/color/create-color-area-state.d.ts +105 -0
  73. package/dist/color/create-color-area-state.js +138 -0
  74. package/dist/color/create-color-area-state.js.map +1 -0
  75. package/dist/color/create-color-channel-field-state.d.ts +29 -0
  76. package/dist/color/create-color-channel-field-state.js +69 -0
  77. package/dist/color/create-color-channel-field-state.js.map +1 -0
  78. package/dist/color/create-color-field-state.d.ts +61 -0
  79. package/dist/color/create-color-field-state.js +113 -0
  80. package/dist/color/create-color-field-state.js.map +1 -0
  81. package/dist/color/create-color-picker-state.d.ts +16 -0
  82. package/dist/color/create-color-picker-state.js +26 -0
  83. package/dist/color/create-color-picker-state.js.map +1 -0
  84. package/dist/color/create-color-slider-state.d.ts +50 -0
  85. package/dist/color/create-color-slider-state.js +93 -0
  86. package/dist/color/create-color-slider-state.js.map +1 -0
  87. package/dist/color/create-color-wheel-state.d.ts +76 -0
  88. package/dist/color/create-color-wheel-state.js +130 -0
  89. package/dist/color/create-color-wheel-state.js.map +1 -0
  90. package/dist/color/create-color.d.ts +20 -0
  91. package/dist/color/create-color.js +33 -0
  92. package/dist/color/create-color.js.map +1 -0
  93. package/dist/color/types.d.ts +87 -0
  94. package/dist/color/types.js +5 -0
  95. package/dist/combobox/create-combo-box-state.d.ts +157 -0
  96. package/dist/combobox/create-combo-box-state.js +450 -0
  97. package/dist/combobox/create-combo-box-state.js.map +1 -0
  98. package/dist/data/create-async-list.d.ts +88 -0
  99. package/dist/data/create-async-list.js +276 -0
  100. package/dist/data/create-async-list.js.map +1 -0
  101. package/dist/data/create-list-data.d.ts +140 -0
  102. package/dist/data/create-list-data.js +250 -0
  103. package/dist/data/create-list-data.js.map +1 -0
  104. package/dist/data/create-tree-data.d.ts +134 -0
  105. package/dist/data/create-tree-data.js +364 -0
  106. package/dist/data/create-tree-data.js.map +1 -0
  107. package/dist/datepicker/create-date-field-state.d.ts +138 -0
  108. package/dist/datepicker/create-date-field-state.js +449 -0
  109. package/dist/datepicker/create-date-field-state.js.map +1 -0
  110. package/dist/datepicker/create-date-picker-state.d.ts +82 -0
  111. package/dist/datepicker/create-date-picker-state.js +191 -0
  112. package/dist/datepicker/create-date-picker-state.js.map +1 -0
  113. package/dist/datepicker/create-date-range-picker-state.d.ts +97 -0
  114. package/dist/datepicker/create-date-range-picker-state.js +305 -0
  115. package/dist/datepicker/create-date-range-picker-state.js.map +1 -0
  116. package/dist/datepicker/create-time-field-state.d.ts +34 -0
  117. package/dist/datepicker/create-time-field-state.js +128 -0
  118. package/dist/datepicker/create-time-field-state.js.map +1 -0
  119. package/dist/datepicker/incomplete-date.d.ts +71 -0
  120. package/dist/datepicker/incomplete-date.js +324 -0
  121. package/dist/datepicker/incomplete-date.js.map +1 -0
  122. package/dist/datepicker/placeholders.d.ts +18 -0
  123. package/dist/datepicker/placeholders.js +418 -0
  124. package/dist/datepicker/placeholders.js.map +1 -0
  125. package/dist/datepicker/types.d.ts +131 -0
  126. package/dist/datepicker/types.js +16 -0
  127. package/dist/datepicker/utils.d.ts +37 -0
  128. package/dist/datepicker/utils.js +168 -0
  129. package/dist/datepicker/utils.js.map +1 -0
  130. package/dist/disclosure/create-disclosure-group-state.d.ts +47 -0
  131. package/dist/disclosure/create-disclosure-group-state.js +62 -0
  132. package/dist/disclosure/create-disclosure-group-state.js.map +1 -0
  133. package/dist/disclosure/create-disclosure-state.d.ts +42 -0
  134. package/dist/disclosure/create-disclosure-state.js +49 -0
  135. package/dist/disclosure/create-disclosure-state.js.map +1 -0
  136. package/dist/dnd/create-draggable-collection-state.d.ts +63 -0
  137. package/dist/dnd/create-draggable-collection-state.js +136 -0
  138. package/dist/dnd/create-draggable-collection-state.js.map +1 -0
  139. package/dist/dnd/create-droppable-collection-state.d.ts +55 -0
  140. package/dist/dnd/create-droppable-collection-state.js +155 -0
  141. package/dist/dnd/create-droppable-collection-state.js.map +1 -0
  142. package/dist/flags/flags.d.ts +21 -0
  143. package/dist/flags/flags.js +34 -0
  144. package/dist/flags/flags.js.map +1 -0
  145. package/dist/form/create-form-validation-state.d.ts +37 -0
  146. package/dist/form/create-form-validation-state.js +152 -0
  147. package/dist/form/create-form-validation-state.js.map +1 -0
  148. package/dist/grid/create-grid-state.d.ts +38 -0
  149. package/dist/grid/create-grid-state.js +85 -0
  150. package/dist/grid/create-grid-state.js.map +1 -0
  151. package/dist/grid/grid-collection.d.ts +68 -0
  152. package/dist/grid/grid-collection.js +133 -0
  153. package/dist/grid/grid-collection.js.map +1 -0
  154. package/dist/index.d.ts +91 -0
  155. package/dist/index.js +86 -0
  156. package/dist/intl/color/ar-AE.js +44 -0
  157. package/dist/intl/color/ar-AE.js.map +1 -0
  158. package/dist/intl/color/bg-BG.js +44 -0
  159. package/dist/intl/color/bg-BG.js.map +1 -0
  160. package/dist/intl/color/cs-CZ.js +44 -0
  161. package/dist/intl/color/cs-CZ.js.map +1 -0
  162. package/dist/intl/color/da-DK.js +44 -0
  163. package/dist/intl/color/da-DK.js.map +1 -0
  164. package/dist/intl/color/de-DE.js +44 -0
  165. package/dist/intl/color/de-DE.js.map +1 -0
  166. package/dist/intl/color/el-GR.js +44 -0
  167. package/dist/intl/color/el-GR.js.map +1 -0
  168. package/dist/intl/color/en-US.js +44 -0
  169. package/dist/intl/color/en-US.js.map +1 -0
  170. package/dist/intl/color/es-ES.js +44 -0
  171. package/dist/intl/color/es-ES.js.map +1 -0
  172. package/dist/intl/color/et-EE.js +44 -0
  173. package/dist/intl/color/et-EE.js.map +1 -0
  174. package/dist/intl/color/fi-FI.js +44 -0
  175. package/dist/intl/color/fi-FI.js.map +1 -0
  176. package/dist/intl/color/fr-FR.js +44 -0
  177. package/dist/intl/color/fr-FR.js.map +1 -0
  178. package/dist/intl/color/he-IL.js +44 -0
  179. package/dist/intl/color/he-IL.js.map +1 -0
  180. package/dist/intl/color/hr-HR.js +44 -0
  181. package/dist/intl/color/hr-HR.js.map +1 -0
  182. package/dist/intl/color/hu-HU.js +44 -0
  183. package/dist/intl/color/hu-HU.js.map +1 -0
  184. package/dist/intl/color/index.js +75 -0
  185. package/dist/intl/color/index.js.map +1 -0
  186. package/dist/intl/color/it-IT.js +44 -0
  187. package/dist/intl/color/it-IT.js.map +1 -0
  188. package/dist/intl/color/ja-JP.js +44 -0
  189. package/dist/intl/color/ja-JP.js.map +1 -0
  190. package/dist/intl/color/ko-KR.js +44 -0
  191. package/dist/intl/color/ko-KR.js.map +1 -0
  192. package/dist/intl/color/lt-LT.js +44 -0
  193. package/dist/intl/color/lt-LT.js.map +1 -0
  194. package/dist/intl/color/lv-LV.js +44 -0
  195. package/dist/intl/color/lv-LV.js.map +1 -0
  196. package/dist/intl/color/nb-NO.js +44 -0
  197. package/dist/intl/color/nb-NO.js.map +1 -0
  198. package/dist/intl/color/nl-NL.js +44 -0
  199. package/dist/intl/color/nl-NL.js.map +1 -0
  200. package/dist/intl/color/pl-PL.js +44 -0
  201. package/dist/intl/color/pl-PL.js.map +1 -0
  202. package/dist/intl/color/pt-BR.js +44 -0
  203. package/dist/intl/color/pt-BR.js.map +1 -0
  204. package/dist/intl/color/pt-PT.js +44 -0
  205. package/dist/intl/color/pt-PT.js.map +1 -0
  206. package/dist/intl/color/ro-RO.js +44 -0
  207. package/dist/intl/color/ro-RO.js.map +1 -0
  208. package/dist/intl/color/ru-RU.js +44 -0
  209. package/dist/intl/color/ru-RU.js.map +1 -0
  210. package/dist/intl/color/sk-SK.js +44 -0
  211. package/dist/intl/color/sk-SK.js.map +1 -0
  212. package/dist/intl/color/sl-SI.js +44 -0
  213. package/dist/intl/color/sl-SI.js.map +1 -0
  214. package/dist/intl/color/sr-SP.js +44 -0
  215. package/dist/intl/color/sr-SP.js.map +1 -0
  216. package/dist/intl/color/sv-SE.js +44 -0
  217. package/dist/intl/color/sv-SE.js.map +1 -0
  218. package/dist/intl/color/tr-TR.js +44 -0
  219. package/dist/intl/color/tr-TR.js.map +1 -0
  220. package/dist/intl/color/uk-UA.js +44 -0
  221. package/dist/intl/color/uk-UA.js.map +1 -0
  222. package/dist/intl/color/zh-CN.js +44 -0
  223. package/dist/intl/color/zh-CN.js.map +1 -0
  224. package/dist/intl/color/zh-TW.js +44 -0
  225. package/dist/intl/color/zh-TW.js.map +1 -0
  226. package/dist/intl/datepicker/ar-AE.js +11 -0
  227. package/dist/intl/datepicker/ar-AE.js.map +1 -0
  228. package/dist/intl/datepicker/bg-BG.js +11 -0
  229. package/dist/intl/datepicker/bg-BG.js.map +1 -0
  230. package/dist/intl/datepicker/cs-CZ.js +11 -0
  231. package/dist/intl/datepicker/cs-CZ.js.map +1 -0
  232. package/dist/intl/datepicker/da-DK.js +11 -0
  233. package/dist/intl/datepicker/da-DK.js.map +1 -0
  234. package/dist/intl/datepicker/de-DE.js +11 -0
  235. package/dist/intl/datepicker/de-DE.js.map +1 -0
  236. package/dist/intl/datepicker/el-GR.js +11 -0
  237. package/dist/intl/datepicker/el-GR.js.map +1 -0
  238. package/dist/intl/datepicker/en-US.js +11 -0
  239. package/dist/intl/datepicker/en-US.js.map +1 -0
  240. package/dist/intl/datepicker/es-ES.js +11 -0
  241. package/dist/intl/datepicker/es-ES.js.map +1 -0
  242. package/dist/intl/datepicker/et-EE.js +11 -0
  243. package/dist/intl/datepicker/et-EE.js.map +1 -0
  244. package/dist/intl/datepicker/fi-FI.js +11 -0
  245. package/dist/intl/datepicker/fi-FI.js.map +1 -0
  246. package/dist/intl/datepicker/fr-FR.js +11 -0
  247. package/dist/intl/datepicker/fr-FR.js.map +1 -0
  248. package/dist/intl/datepicker/he-IL.js +11 -0
  249. package/dist/intl/datepicker/he-IL.js.map +1 -0
  250. package/dist/intl/datepicker/hr-HR.js +11 -0
  251. package/dist/intl/datepicker/hr-HR.js.map +1 -0
  252. package/dist/intl/datepicker/hu-HU.js +11 -0
  253. package/dist/intl/datepicker/hu-HU.js.map +1 -0
  254. package/dist/intl/datepicker/index.js +75 -0
  255. package/dist/intl/datepicker/index.js.map +1 -0
  256. package/dist/intl/datepicker/it-IT.js +11 -0
  257. package/dist/intl/datepicker/it-IT.js.map +1 -0
  258. package/dist/intl/datepicker/ja-JP.js +11 -0
  259. package/dist/intl/datepicker/ja-JP.js.map +1 -0
  260. package/dist/intl/datepicker/ko-KR.js +11 -0
  261. package/dist/intl/datepicker/ko-KR.js.map +1 -0
  262. package/dist/intl/datepicker/lt-LT.js +11 -0
  263. package/dist/intl/datepicker/lt-LT.js.map +1 -0
  264. package/dist/intl/datepicker/lv-LV.js +11 -0
  265. package/dist/intl/datepicker/lv-LV.js.map +1 -0
  266. package/dist/intl/datepicker/nb-NO.js +11 -0
  267. package/dist/intl/datepicker/nb-NO.js.map +1 -0
  268. package/dist/intl/datepicker/nl-NL.js +11 -0
  269. package/dist/intl/datepicker/nl-NL.js.map +1 -0
  270. package/dist/intl/datepicker/pl-PL.js +11 -0
  271. package/dist/intl/datepicker/pl-PL.js.map +1 -0
  272. package/dist/intl/datepicker/pt-BR.js +11 -0
  273. package/dist/intl/datepicker/pt-BR.js.map +1 -0
  274. package/dist/intl/datepicker/pt-PT.js +11 -0
  275. package/dist/intl/datepicker/pt-PT.js.map +1 -0
  276. package/dist/intl/datepicker/ro-RO.js +11 -0
  277. package/dist/intl/datepicker/ro-RO.js.map +1 -0
  278. package/dist/intl/datepicker/ru-RU.js +11 -0
  279. package/dist/intl/datepicker/ru-RU.js.map +1 -0
  280. package/dist/intl/datepicker/sk-SK.js +11 -0
  281. package/dist/intl/datepicker/sk-SK.js.map +1 -0
  282. package/dist/intl/datepicker/sl-SI.js +11 -0
  283. package/dist/intl/datepicker/sl-SI.js.map +1 -0
  284. package/dist/intl/datepicker/sr-SP.js +11 -0
  285. package/dist/intl/datepicker/sr-SP.js.map +1 -0
  286. package/dist/intl/datepicker/sv-SE.js +11 -0
  287. package/dist/intl/datepicker/sv-SE.js.map +1 -0
  288. package/dist/intl/datepicker/tr-TR.js +11 -0
  289. package/dist/intl/datepicker/tr-TR.js.map +1 -0
  290. package/dist/intl/datepicker/uk-UA.js +11 -0
  291. package/dist/intl/datepicker/uk-UA.js.map +1 -0
  292. package/dist/intl/datepicker/zh-CN.js +11 -0
  293. package/dist/intl/datepicker/zh-CN.js.map +1 -0
  294. package/dist/intl/datepicker/zh-TW.js +11 -0
  295. package/dist/intl/datepicker/zh-TW.js.map +1 -0
  296. package/dist/layout/grid-layout.d.ts +107 -0
  297. package/dist/layout/grid-layout.js +253 -0
  298. package/dist/layout/grid-layout.js.map +1 -0
  299. package/dist/layout/list-layout.d.ts +187 -0
  300. package/dist/layout/list-layout.js +488 -0
  301. package/dist/layout/list-layout.js.map +1 -0
  302. package/dist/layout/table-layout.d.ts +98 -0
  303. package/dist/layout/table-layout.js +476 -0
  304. package/dist/layout/table-layout.js.map +1 -0
  305. package/dist/layout/waterfall-layout.d.ts +85 -0
  306. package/dist/layout/waterfall-layout.js +225 -0
  307. package/dist/layout/waterfall-layout.js.map +1 -0
  308. package/dist/list/create-list-state.d.ts +48 -0
  309. package/dist/list/create-list-state.js +123 -0
  310. package/dist/list/create-list-state.js.map +1 -0
  311. package/dist/list/create-single-select-list-state.d.ts +38 -0
  312. package/dist/list/create-single-select-list-state.js +55 -0
  313. package/dist/list/create-single-select-list-state.js.map +1 -0
  314. package/dist/list/list-collection.d.ts +36 -0
  315. package/dist/list/list-collection.js +91 -0
  316. package/dist/list/list-collection.js.map +1 -0
  317. package/dist/menu/create-menu-trigger-state.d.ts +55 -0
  318. package/dist/menu/create-menu-trigger-state.js +58 -0
  319. package/dist/menu/create-menu-trigger-state.js.map +1 -0
  320. package/dist/menu/create-submenu-trigger-state.d.ts +47 -0
  321. package/dist/menu/create-submenu-trigger-state.js +59 -0
  322. package/dist/menu/create-submenu-trigger-state.js.map +1 -0
  323. package/dist/numberfield/create-number-field-state.d.ts +93 -0
  324. package/dist/numberfield/create-number-field-state.js +139 -0
  325. package/dist/numberfield/create-number-field-state.js.map +1 -0
  326. package/dist/overlays/create-overlay-trigger-state.d.ts +51 -0
  327. package/dist/overlays/create-overlay-trigger-state.js +56 -0
  328. package/dist/overlays/create-overlay-trigger-state.js.map +1 -0
  329. package/dist/radio/create-radio-group-state.d.ts +61 -0
  330. package/dist/radio/create-radio-group-state.js +71 -0
  331. package/dist/radio/create-radio-group-state.js.map +1 -0
  332. package/dist/searchfield/create-search-field-state.d.ts +35 -0
  333. package/dist/searchfield/create-search-field-state.js +34 -0
  334. package/dist/searchfield/create-search-field-state.js.map +1 -0
  335. package/dist/select/create-select-state.d.ts +116 -0
  336. package/dist/select/create-select-state.js +151 -0
  337. package/dist/select/create-select-state.js.map +1 -0
  338. package/dist/selection/create-multiple-selection-state.d.ts +39 -0
  339. package/dist/selection/create-multiple-selection-state.js +114 -0
  340. package/dist/selection/create-multiple-selection-state.js.map +1 -0
  341. package/dist/selection/selection-manager.d.ts +139 -0
  342. package/dist/selection/selection-manager.js +334 -0
  343. package/dist/selection/selection-manager.js.map +1 -0
  344. package/dist/selection/selection.d.ts +27 -0
  345. package/dist/selection/selection.js +38 -0
  346. package/dist/selection/selection.js.map +1 -0
  347. package/dist/selection/types.d.ts +116 -0
  348. package/dist/selection/types.js +16 -0
  349. package/dist/slider/create-slider-state.d.ts +182 -0
  350. package/dist/slider/create-slider-state.js +131 -0
  351. package/dist/slider/create-slider-state.js.map +1 -0
  352. package/dist/steplist/create-step-list-state.d.ts +40 -0
  353. package/dist/steplist/create-step-list-state.js +132 -0
  354. package/dist/steplist/create-step-list-state.js.map +1 -0
  355. package/dist/table/cell.d.ts +37 -0
  356. package/dist/table/cell.js +47 -0
  357. package/dist/table/cell.js.map +1 -0
  358. package/dist/table/collection-context.d.ts +4 -0
  359. package/dist/table/collection-context.js +8 -0
  360. package/dist/table/collection-context.js.map +1 -0
  361. package/dist/table/column.d.ts +66 -0
  362. package/dist/table/column.js +71 -0
  363. package/dist/table/column.js.map +1 -0
  364. package/dist/table/create-table-column-resize-state.d.ts +65 -0
  365. package/dist/table/create-table-column-resize-state.js +100 -0
  366. package/dist/table/create-table-column-resize-state.js.map +1 -0
  367. package/dist/table/create-table-state.d.ts +112 -0
  368. package/dist/table/create-table-state.js +122 -0
  369. package/dist/table/create-table-state.js.map +1 -0
  370. package/dist/table/create-tree-grid-state.d.ts +44 -0
  371. package/dist/table/create-tree-grid-state.js +145 -0
  372. package/dist/table/create-tree-grid-state.js.map +1 -0
  373. package/dist/table/row.d.ts +44 -0
  374. package/dist/table/row.js +91 -0
  375. package/dist/table/row.js.map +1 -0
  376. package/dist/table/table-body.d.ts +36 -0
  377. package/dist/table/table-body.js +57 -0
  378. package/dist/table/table-body.js.map +1 -0
  379. package/dist/table/table-collection.d.ts +62 -0
  380. package/dist/table/table-collection.js +274 -0
  381. package/dist/table/table-collection.js.map +1 -0
  382. package/dist/table/table-column-layout.d.ts +47 -0
  383. package/dist/table/table-column-layout.js +94 -0
  384. package/dist/table/table-column-layout.js.map +1 -0
  385. package/dist/table/table-header.d.ts +37 -0
  386. package/dist/table/table-header.js +52 -0
  387. package/dist/table/table-header.js.map +1 -0
  388. package/dist/table/table-utils.d.ts +60 -0
  389. package/dist/table/table-utils.js +203 -0
  390. package/dist/table/table-utils.js.map +1 -0
  391. package/dist/tabs/create-tab-list-state.d.ts +42 -0
  392. package/dist/tabs/create-tab-list-state.js +78 -0
  393. package/dist/tabs/create-tab-list-state.js.map +1 -0
  394. package/dist/toast/create-toast-state.d.ts +97 -0
  395. package/dist/toast/create-toast-state.js +166 -0
  396. package/dist/toast/create-toast-state.js.map +1 -0
  397. package/dist/toggle/create-toggle-group-state.d.ts +55 -0
  398. package/dist/toggle/create-toggle-group-state.js +62 -0
  399. package/dist/toggle/create-toggle-group-state.js.map +1 -0
  400. package/dist/toggle/create-toggle-state.d.ts +58 -0
  401. package/dist/toggle/create-toggle-state.js +43 -0
  402. package/dist/toggle/create-toggle-state.js.map +1 -0
  403. package/dist/tokenfield/create-token-field-state.d.ts +39 -0
  404. package/dist/tokenfield/create-token-field-state.js +44 -0
  405. package/dist/tokenfield/create-token-field-state.js.map +1 -0
  406. package/dist/tokenfield/token-field-value.d.ts +111 -0
  407. package/dist/tokenfield/token-field-value.js +327 -0
  408. package/dist/tokenfield/token-field-value.js.map +1 -0
  409. package/dist/tooltip/create-tooltip-trigger-state.d.ts +73 -0
  410. package/dist/tooltip/create-tooltip-trigger-state.js +136 -0
  411. package/dist/tooltip/create-tooltip-trigger-state.js.map +1 -0
  412. package/dist/tree/create-tree-state.d.ts +42 -0
  413. package/dist/tree/create-tree-state.js +75 -0
  414. package/dist/tree/create-tree-state.js.map +1 -0
  415. package/dist/tree/tree-collection.d.ts +36 -0
  416. package/dist/tree/tree-collection.js +84 -0
  417. package/dist/tree/tree-collection.js.map +1 -0
  418. package/dist/utils/create-controlled-signal.d.ts +23 -0
  419. package/dist/utils/create-controlled-signal.js +54 -0
  420. package/dist/utils/create-controlled-signal.js.map +1 -0
  421. package/dist/utils/get-item-key.d.ts +5 -0
  422. package/dist/utils/get-item-key.js +12 -0
  423. package/dist/utils/get-item-key.js.map +1 -0
  424. package/dist/utils/get-node-props.d.ts +23 -0
  425. package/dist/utils/get-node-props.js +38 -0
  426. package/dist/utils/get-node-props.js.map +1 -0
  427. package/dist/utils/has-content.d.ts +5 -0
  428. package/dist/utils/has-content.js +7 -0
  429. package/dist/utils/has-content.js.map +1 -0
  430. package/dist/utils/legacy-props.d.ts +10 -0
  431. package/dist/utils/legacy-props.js +17 -0
  432. package/dist/utils/legacy-props.js.map +1 -0
  433. package/dist/utils/number.d.ts +25 -0
  434. package/dist/utils/number.js +59 -0
  435. package/dist/utils/number.js.map +1 -0
  436. package/dist/utils/parse-calendar-identifier.d.ts +5 -0
  437. package/dist/utils/parse-calendar-identifier.js +31 -0
  438. package/dist/utils/parse-calendar-identifier.js.map +1 -0
  439. package/dist/utils/require-value.d.ts +4 -0
  440. package/dist/utils/require-value.js +10 -0
  441. package/dist/utils/require-value.js.map +1 -0
  442. package/dist/virtualizer/create-virtualizer-state.d.ts +44 -0
  443. package/dist/virtualizer/create-virtualizer-state.js +92 -0
  444. package/dist/virtualizer/create-virtualizer-state.js.map +1 -0
  445. package/dist/virtualizer/layout-info.d.ts +94 -0
  446. package/dist/virtualizer/layout-info.js +118 -0
  447. package/dist/virtualizer/layout-info.js.map +1 -0
  448. package/dist/virtualizer/layout.d.ts +91 -0
  449. package/dist/virtualizer/layout.js +71 -0
  450. package/dist/virtualizer/layout.js.map +1 -0
  451. package/dist/virtualizer/overscan-manager.d.ts +25 -0
  452. package/dist/virtualizer/overscan-manager.js +46 -0
  453. package/dist/virtualizer/overscan-manager.js.map +1 -0
  454. package/dist/virtualizer/point.d.ts +36 -0
  455. package/dist/virtualizer/point.js +48 -0
  456. package/dist/virtualizer/point.js.map +1 -0
  457. package/dist/virtualizer/rect.d.ts +103 -0
  458. package/dist/virtualizer/rect.js +156 -0
  459. package/dist/virtualizer/rect.js.map +1 -0
  460. package/dist/virtualizer/reusable-view.d.ts +51 -0
  461. package/dist/virtualizer/reusable-view.js +81 -0
  462. package/dist/virtualizer/reusable-view.js.map +1 -0
  463. package/dist/virtualizer/scroll-anchor.d.ts +98 -0
  464. package/dist/virtualizer/scroll-anchor.js +150 -0
  465. package/dist/virtualizer/scroll-anchor.js.map +1 -0
  466. package/dist/virtualizer/size.d.ts +34 -0
  467. package/dist/virtualizer/size.js +46 -0
  468. package/dist/virtualizer/size.js.map +1 -0
  469. package/dist/virtualizer/types.d.ts +47 -0
  470. package/dist/virtualizer/types.js +16 -0
  471. package/dist/virtualizer/utils.d.ts +19 -0
  472. package/dist/virtualizer/utils.js +27 -0
  473. package/dist/virtualizer/utils.js.map +1 -0
  474. package/dist/virtualizer/virtualizer.d.ts +99 -0
  475. package/dist/virtualizer/virtualizer.js +314 -0
  476. package/dist/virtualizer/virtualizer.js.map +1 -0
  477. package/package.json +174 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oklch.js","names":[],"sources":["../../../src/color/color/oklch.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/*\n * Derived from Adobe React Spectrum: packages/react-stately/src/color/Color.ts.\n * Modified for Solid Aria: reorganized color code, type declarations, imports, and formatting.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport type { Color } from \"../types\";\n\nfunction multiplyMatrix(\n m: [number, number, number, number, number, number, number, number, number],\n x: number,\n y: number,\n z: number\n): [number, number, number] {\n const a = m[0] * x + m[1] * y + m[2] * z;\n const b = m[3] * x + m[4] * y + m[5] * z;\n const c = m[6] * x + m[7] * y + m[8] * z;\n\n return [a, b, c];\n}\n\nfunction lin_sRGB_component(val: number) {\n const sign = val < 0 ? -1 : 1;\n const abs = Math.abs(val);\n\n if (abs <= 0.04045) {\n return val / 12.92;\n }\n\n return sign * ((abs + 0.055) / 1.055) ** 2.4;\n}\n\nfunction lin_sRGB(r: number, g: number, b: number): [number, number, number] {\n // convert an array of sRGB values\n // where in-gamut values are in the range [0 - 1]\n // to linear light (un-companded) form.\n // https://en.wikipedia.org/wiki/SRGB\n // Extended transfer function:\n // for negative values, linear portion is extended on reflection of axis,\n // then reflected power function is used.\n return [lin_sRGB_component(r), lin_sRGB_component(g), lin_sRGB_component(b)];\n}\n\nfunction lin_sRGB_to_XYZ(r: number, g: number, b: number) {\n // convert an array of linear-light sRGB values to CIE XYZ\n // using sRGB's own white, D65 (no chromatic adaptation)\n const M: [\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n ] = [\n 506_752 / 1_228_815,\n 87_881 / 245_763,\n 12_673 / 70_218,\n 87_098 / 409_605,\n 175_762 / 245_763,\n 12_673 / 175_545,\n 7918 / 409_605,\n 87_881 / 737_289,\n 1_001_167 / 1_053_270,\n ];\n\n return multiplyMatrix(M, r, g, b);\n}\n\nfunction XYZ_to_OKLab(x: number, y: number, z: number) {\n // Given XYZ relative to D65, convert to OKLab\n const XYZtoLMS: [\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n ] = [\n 0.819022437996703, 0.3619062600528904, -0.1288737815209879,\n 0.0329836539323885, 0.9292868615863434, 0.0361446663506424,\n 0.0481771893596242, 0.2642395317527308, 0.6335478284694309,\n ];\n\n const LMStoOKLab: [\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n ] = [\n 0.210454268309314, 0.7936177747023054, -0.0040720430116193,\n 1.9779985324311684, -2.4285922420485799, 0.450593709617411,\n 0.0259040424655478, 0.7827717124575296, -0.8086757549230774,\n ];\n\n const [a, b, c] = multiplyMatrix(XYZtoLMS, x, y, z);\n\n return multiplyMatrix(LMStoOKLab, Math.cbrt(a), Math.cbrt(b), Math.cbrt(c));\n}\n\nfunction OKLab_to_OKLCH(\n l: number,\n a: number,\n b: number\n): [number, number, number] {\n const hue = (Math.atan2(b, a) * 180) / Math.PI;\n\n return [l, Math.hypot(a, b), hue >= 0 ? hue : hue + 360];\n}\n\n// https://www.w3.org/TR/css-color-4/#color-conversion-code\nexport function toOKLCH(color: Pick<Color, \"toFormat\">) {\n const rgb = color.toFormat(\"rgb\");\n let red = rgb.getChannelValue(\"red\") / 255;\n let green = rgb.getChannelValue(\"green\") / 255;\n let blue = rgb.getChannelValue(\"blue\") / 255;\n [red, green, blue] = lin_sRGB(red, green, blue);\n const [x, y, z] = lin_sRGB_to_XYZ(red, green, blue);\n const [l, a, b] = XYZ_to_OKLab(x, y, z);\n\n return OKLab_to_OKLCH(l, a, b);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAmBA,SAAS,eACP,GACA,GACA,GACA,GAC0B;CAK1B,OAAO;EAJG,EAAE,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,KAAK;EAC7B,EAAE,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,KAAK;EAC7B,EAAE,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,KAAK;CAExB;AACjB;AAEA,SAAS,mBAAmB,KAAa;CACvC,MAAM,OAAO,MAAM,IAAI,KAAK;CAC5B,MAAM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OAAO,IAAI;CAC9C,MAAM,CAAC,GAAG,GAAG,KAAK,gBAAgB,KAAK,OAAO,IAAI;CAClD,MAAM,CAAC,GAAG,GAAG,KAAK,aAAa,GAAG,GAAG,CAAC;CAEtC,OAAO,eAAe,GAAG,GAAG,CAAC;AAC/B"}
@@ -0,0 +1,24 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+ /*
13
+ * Derived from Adobe React Spectrum: packages/react-stately/src/color/Color.ts.
14
+ * Modified for Solid Aria: reorganized color code, type declarations, imports, and formatting;
15
+ * added explicit constructor types for declaration emission.
16
+ * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.
17
+ */
18
+ import { Color } from "../types.js";
19
+ import { ColorConstructors } from "./color-constructors.js";
20
+ export declare function createRGBColorClass(getColorClasses: () => ColorConstructors): ColorConstructors["RGBColor"] & {
21
+ colorChannels: ReturnType<Color["getColorChannels"]>;
22
+ parse: (value: string) => Color | undefined;
23
+ };
24
+ //# sourceMappingURL=rgb-color.d.ts.map
@@ -0,0 +1,230 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+ /*
13
+ * Derived from Adobe React Spectrum: packages/react-stately/src/color/Color.ts.
14
+ * Modified for Solid Aria: reorganized color code, type declarations, imports, and formatting;
15
+ * added explicit constructor types for declaration emission.
16
+ * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.
17
+ */
18
+ import { clamp, toFixedNumber } from "../../utils/number.js";
19
+ import { Color } from "./base-color.js";
20
+ import { NumberFormatter } from "@internationalized/number";
21
+ // src/color/color/rgb-color.ts
22
+ function createRGBColorClass(getColorClasses) {
23
+ return class RGBColor extends Color {
24
+ red;
25
+ green;
26
+ blue;
27
+ alpha;
28
+ constructor(red, green, blue, alpha) {
29
+ super();
30
+ this.red = red;
31
+ this.green = green;
32
+ this.blue = blue;
33
+ this.alpha = alpha;
34
+ }
35
+ static parse(value) {
36
+ let colors = [];
37
+ if (/^#[\da-f]+$/iu.test(value) && [
38
+ 4,
39
+ 5,
40
+ 7,
41
+ 9
42
+ ].includes(value.length)) {
43
+ const values = (value.length < 6 ? value.replaceAll(/[^#]/giu, "$&$&") : value).slice(1).split("");
44
+ while (values.length > 0) colors.push(Number.parseInt(values.splice(0, 2).join(""), 16));
45
+ colors[3] = colors[3] === void 0 ? void 0 : colors[3] / 255;
46
+ }
47
+ const match = /^rgba?\((?<components>.*)\)$/u.exec(value);
48
+ if (match?.groups?.components !== void 0 && match.groups.components !== "") {
49
+ const parts = match.groups.components.split(",").map((part) => part.trim());
50
+ if (parts.some((part) => part === "" || !Number.isFinite(Number(part)))) return;
51
+ colors = parts.map((part, i) => clamp(Number(part), 0, i < 3 ? 255 : 1));
52
+ }
53
+ if (colors[0] === void 0 || colors[1] === void 0 || colors[2] === void 0) return;
54
+ return colors.length < 3 ? void 0 : new RGBColor(colors[0], colors[1], colors[2], colors[3] ?? 1);
55
+ }
56
+ toString(format = "css") {
57
+ switch (format) {
58
+ case "hex": return `#${(this.red.toString(16).padStart(2, "0") + this.green.toString(16).padStart(2, "0") + this.blue.toString(16).padStart(2, "0")).toUpperCase()}`;
59
+ case "hexa": return `#${(this.red.toString(16).padStart(2, "0") + this.green.toString(16).padStart(2, "0") + this.blue.toString(16).padStart(2, "0") + Math.round(this.alpha * 255).toString(16).padStart(2, "0")).toUpperCase()}`;
60
+ case "rgb": return `rgb(${this.red}, ${this.green}, ${this.blue})`;
61
+ case "css":
62
+ case "rgba": return `rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;
63
+ case "hsb":
64
+ case "hsba":
65
+ case "hsl":
66
+ case "hsla": return this.toFormat(format).toString(format);
67
+ default: throw new Error("Unsupported color format");
68
+ }
69
+ }
70
+ toFormat(format) {
71
+ switch (format) {
72
+ case "hex":
73
+ case "hexa":
74
+ case "rgb":
75
+ case "rgba": return this;
76
+ case "hsb":
77
+ case "hsba": return this.toHSB();
78
+ case "hsl":
79
+ case "hsla": return this.toHSL();
80
+ default: throw new Error("Unsupported color conversion from rgb");
81
+ }
82
+ }
83
+ toHexInt() {
84
+ return this.red << 16 | this.green << 8 | this.blue;
85
+ }
86
+ /**
87
+ * Converts an RGB color value to HSB.
88
+ * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#From_RGB.
89
+ *
90
+ * @returns An HSBColor object.
91
+ */
92
+ toHSB() {
93
+ const red = this.red / 255;
94
+ const green = this.green / 255;
95
+ const blue = this.blue / 255;
96
+ const min = Math.min(red, green, blue);
97
+ const brightness = Math.max(red, green, blue);
98
+ const chroma = brightness - min;
99
+ const saturation = brightness === 0 ? 0 : chroma / brightness;
100
+ let hue = 0;
101
+ if (chroma !== 0) {
102
+ switch (brightness) {
103
+ case red:
104
+ hue = (green - blue) / chroma + (green < blue ? 6 : 0);
105
+ break;
106
+ case green:
107
+ hue = (blue - red) / chroma + 2;
108
+ break;
109
+ default: hue = (red - green) / chroma + 4;
110
+ }
111
+ hue /= 6;
112
+ }
113
+ return new (getColorClasses()).HSBColor(toFixedNumber(hue * 360, 2), toFixedNumber(saturation * 100, 2), toFixedNumber(brightness * 100, 2), this.alpha);
114
+ }
115
+ /**
116
+ * Converts an RGB color value to HSL.
117
+ * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#From_RGB.
118
+ *
119
+ * @returns An HSLColor object.
120
+ */
121
+ toHSL() {
122
+ const red = this.red / 255;
123
+ const green = this.green / 255;
124
+ const blue = this.blue / 255;
125
+ const min = Math.min(red, green, blue);
126
+ const max = Math.max(red, green, blue);
127
+ const lightness = (max + min) / 2;
128
+ const chroma = max - min;
129
+ let hue;
130
+ let saturation;
131
+ if (chroma === 0) {
132
+ hue = 0;
133
+ saturation = 0;
134
+ } else {
135
+ saturation = chroma / (lightness < .5 ? max + min : 2 - max - min);
136
+ switch (max) {
137
+ case red:
138
+ hue = (green - blue) / chroma + (green < blue ? 6 : 0);
139
+ break;
140
+ case green:
141
+ hue = (blue - red) / chroma + 2;
142
+ break;
143
+ default: hue = (red - green) / chroma + 4;
144
+ }
145
+ hue /= 6;
146
+ }
147
+ return new (getColorClasses()).HSLColor(toFixedNumber(hue * 360, 2), toFixedNumber(saturation * 100, 2), toFixedNumber(lightness * 100, 2), this.alpha);
148
+ }
149
+ getChannelValue(channel) {
150
+ const value = {
151
+ alpha: this.alpha,
152
+ blue: this.blue,
153
+ green: this.green,
154
+ red: this.red
155
+ }[channel];
156
+ if (value === void 0) throw new Error(`Unsupported color channel: ${channel}`);
157
+ return value;
158
+ }
159
+ withChannelValue(channel, value) {
160
+ this.getChannelValue(channel);
161
+ return new RGBColor(channel === "red" ? value : this.red, channel === "green" ? value : this.green, channel === "blue" ? value : this.blue, channel === "alpha" ? value : this.alpha);
162
+ }
163
+ clone() {
164
+ return new RGBColor(this.red, this.green, this.blue, this.alpha);
165
+ }
166
+ channelRanges = {
167
+ alpha: {
168
+ maxValue: 1,
169
+ minValue: 0,
170
+ pageSize: .1,
171
+ step: .01
172
+ },
173
+ blue: {
174
+ maxValue: 255,
175
+ minValue: 0,
176
+ pageSize: 17,
177
+ step: 1
178
+ },
179
+ green: {
180
+ maxValue: 255,
181
+ minValue: 0,
182
+ pageSize: 17,
183
+ step: 1
184
+ },
185
+ red: {
186
+ maxValue: 255,
187
+ minValue: 0,
188
+ pageSize: 17,
189
+ step: 1
190
+ }
191
+ };
192
+ getChannelRange(channel) {
193
+ const value = this.channelRanges[channel];
194
+ if (value === void 0) throw new Error(`Unknown color channel: ${channel}`);
195
+ return value;
196
+ }
197
+ channelFormatOptions = {
198
+ alpha: { style: "percent" },
199
+ blue: { style: "decimal" },
200
+ green: { style: "decimal" },
201
+ red: { style: "decimal" }
202
+ };
203
+ getChannelFormatOptions(channel) {
204
+ const value = this.channelFormatOptions[channel];
205
+ if (value === void 0) throw new Error(`Unknown color channel: ${channel}`);
206
+ return value;
207
+ }
208
+ formatChannelValue(channel, locale) {
209
+ const options = this.getChannelFormatOptions(channel);
210
+ const value = this.getChannelValue(channel);
211
+ return new NumberFormatter(locale, options).format(value);
212
+ }
213
+ colorSpace = "rgb";
214
+ getColorSpace() {
215
+ return this.colorSpace;
216
+ }
217
+ static colorChannels = [
218
+ "red",
219
+ "green",
220
+ "blue"
221
+ ];
222
+ colorChannels = RGBColor.colorChannels;
223
+ getColorChannels() {
224
+ return this.colorChannels;
225
+ }
226
+ };
227
+ }
228
+ export { createRGBColorClass };
229
+
230
+ //# sourceMappingURL=rgb-color.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rgb-color.js","names":[],"sources":["../../../src/color/color/rgb-color.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/*\n * Derived from Adobe React Spectrum: packages/react-stately/src/color/Color.ts.\n * Modified for Solid Aria: reorganized color code, type declarations, imports, and formatting;\n * added explicit constructor types for declaration emission.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport { NumberFormatter } from \"@internationalized/number\";\n\nimport { clamp, toFixedNumber } from \"../../utils/number\";\nimport type {\n ColorChannel,\n ColorChannelRange,\n ColorFormat,\n ColorSpace,\n Color as IColor,\n} from \"../types\";\nimport { Color } from \"./base-color\";\nimport type { ColorConstructors } from \"./color-constructors\";\n\nexport function createRGBColorClass(\n getColorClasses: () => ColorConstructors\n): ColorConstructors[\"RGBColor\"] & {\n colorChannels: ReturnType<IColor[\"getColorChannels\"]>;\n parse: (value: string) => IColor | undefined;\n} {\n return class RGBColor extends Color {\n private readonly red: number;\n private readonly green: number;\n private readonly blue: number;\n private readonly alpha: number;\n\n constructor(red: number, green: number, blue: number, alpha: number) {\n super();\n this.red = red;\n this.green = green;\n this.blue = blue;\n this.alpha = alpha;\n }\n\n static parse(value: string): RGBColor | undefined {\n let colors: (number | undefined)[] = [];\n\n // matching #rgb, #rgba, #rrggbb, #rrggbbaa\n if (/^#[\\da-f]+$/iu.test(value) && [4, 5, 7, 9].includes(value.length)) {\n const values = (\n value.length < 6 ? value.replaceAll(/[^#]/giu, \"$&$&\") : value\n )\n .slice(1)\n .split(\"\");\n\n while (values.length > 0) {\n colors.push(Number.parseInt(values.splice(0, 2).join(\"\"), 16));\n }\n\n colors[3] = colors[3] === undefined ? undefined : colors[3] / 255;\n }\n\n // matching rgb(rrr, ggg, bbb), rgba(rrr, ggg, bbb, 0.a)\n const match = /^rgba?\\((?<components>.*)\\)$/u.exec(value);\n\n if (\n match?.groups?.components !== undefined &&\n match.groups.components !== \"\"\n ) {\n const parts = match.groups.components\n .split(\",\")\n .map((part) => part.trim());\n\n // Number('') is 0 rather than NaN, so empty components need their own check.\n if (\n parts.some((part) => part === \"\" || !Number.isFinite(Number(part)))\n ) {\n return undefined;\n }\n\n colors = parts.map((part, i) =>\n clamp(Number(part), 0, i < 3 ? 255 : 1)\n );\n }\n\n if (\n colors[0] === undefined ||\n colors[1] === undefined ||\n colors[2] === undefined\n ) {\n return undefined;\n }\n\n return colors.length < 3\n ? undefined\n : new RGBColor(colors[0], colors[1], colors[2], colors[3] ?? 1);\n }\n\n toString(format: ColorFormat | \"css\" = \"css\") {\n switch (format) {\n case \"hex\": {\n return `#${(\n this.red.toString(16).padStart(2, \"0\") +\n this.green.toString(16).padStart(2, \"0\") +\n this.blue.toString(16).padStart(2, \"0\")\n ).toUpperCase()}`;\n }\n\n case \"hexa\": {\n return `#${(\n this.red.toString(16).padStart(2, \"0\") +\n this.green.toString(16).padStart(2, \"0\") +\n this.blue.toString(16).padStart(2, \"0\") +\n Math.round(this.alpha * 255)\n .toString(16)\n .padStart(2, \"0\")\n ).toUpperCase()}`;\n }\n\n case \"rgb\": {\n return `rgb(${this.red}, ${this.green}, ${this.blue})`;\n }\n\n case \"css\":\n case \"rgba\": {\n return `rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;\n }\n\n case \"hsb\":\n case \"hsba\":\n case \"hsl\":\n case \"hsla\": {\n return this.toFormat(format).toString(format);\n }\n\n default: {\n throw new Error(\"Unsupported color format\");\n }\n }\n }\n\n toFormat(format: ColorFormat): IColor {\n switch (format) {\n case \"hex\":\n case \"hexa\":\n case \"rgb\":\n case \"rgba\": {\n return this;\n }\n\n case \"hsb\":\n case \"hsba\": {\n return this.toHSB();\n }\n\n case \"hsl\":\n case \"hsla\": {\n return this.toHSL();\n }\n\n default: {\n throw new Error(\"Unsupported color conversion from rgb\");\n }\n }\n }\n\n override toHexInt(): number {\n // oxlint-disable-next-line no-bitwise -- Pack channels into a 24-bit integer, truncating fractional values.\n return (this.red << 16) | (this.green << 8) | this.blue;\n }\n\n /**\n * Converts an RGB color value to HSB.\n * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#From_RGB.\n *\n * @returns An HSBColor object.\n */\n private toHSB(): IColor {\n const red = this.red / 255;\n const green = this.green / 255;\n const blue = this.blue / 255;\n const min = Math.min(red, green, blue);\n const brightness = Math.max(red, green, blue);\n const chroma = brightness - min;\n const saturation = brightness === 0 ? 0 : chroma / brightness;\n // Achromatic colors have zero hue.\n let hue = 0;\n\n if (chroma !== 0) {\n switch (brightness) {\n case red: {\n hue = (green - blue) / chroma + (green < blue ? 6 : 0);\n break;\n }\n\n case green: {\n hue = (blue - red) / chroma + 2;\n break;\n }\n\n default: {\n hue = (red - green) / chroma + 4;\n break;\n }\n }\n\n hue /= 6;\n }\n\n return new (getColorClasses().HSBColor)(\n toFixedNumber(hue * 360, 2),\n toFixedNumber(saturation * 100, 2),\n toFixedNumber(brightness * 100, 2),\n this.alpha\n );\n }\n\n /**\n * Converts an RGB color value to HSL.\n * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#From_RGB.\n *\n * @returns An HSLColor object.\n */\n private toHSL(): IColor {\n const red = this.red / 255;\n const green = this.green / 255;\n const blue = this.blue / 255;\n const min = Math.min(red, green, blue);\n const max = Math.max(red, green, blue);\n const lightness = (max + min) / 2;\n const chroma = max - min;\n let hue: number;\n let saturation: number;\n\n if (chroma === 0) {\n // Achromatic colors have zero hue and saturation.\n hue = 0;\n saturation = 0;\n } else {\n saturation = chroma / (lightness < 0.5 ? max + min : 2 - max - min);\n\n switch (max) {\n case red: {\n hue = (green - blue) / chroma + (green < blue ? 6 : 0);\n break;\n }\n\n case green: {\n hue = (blue - red) / chroma + 2;\n break;\n }\n\n default: {\n hue = (red - green) / chroma + 4;\n break;\n }\n }\n\n hue /= 6;\n }\n\n return new (getColorClasses().HSLColor)(\n toFixedNumber(hue * 360, 2),\n toFixedNumber(saturation * 100, 2),\n toFixedNumber(lightness * 100, 2),\n this.alpha\n );\n }\n\n getChannelValue(channel: ColorChannel): number {\n const values: Partial<Record<ColorChannel, number>> = {\n alpha: this.alpha,\n blue: this.blue,\n green: this.green,\n red: this.red,\n };\n\n const value = values[channel];\n\n if (value === undefined) {\n throw new Error(`Unsupported color channel: ${channel}`);\n }\n\n return value;\n }\n\n withChannelValue(channel: ColorChannel, value: number): IColor {\n this.getChannelValue(channel);\n\n return new RGBColor(\n channel === \"red\" ? value : this.red,\n channel === \"green\" ? value : this.green,\n channel === \"blue\" ? value : this.blue,\n channel === \"alpha\" ? value : this.alpha\n );\n }\n\n clone(): IColor {\n return new RGBColor(this.red, this.green, this.blue, this.alpha);\n }\n\n private readonly channelRanges: Partial<\n Record<ColorChannel, ColorChannelRange>\n > = {\n alpha: { maxValue: 1, minValue: 0, pageSize: 0.1, step: 0.01 },\n blue: { maxValue: 255, minValue: 0, pageSize: 17, step: 1 },\n green: { maxValue: 255, minValue: 0, pageSize: 17, step: 1 },\n red: { maxValue: 255, minValue: 0, pageSize: 17, step: 1 },\n };\n\n getChannelRange(channel: ColorChannel): ColorChannelRange {\n const value = this.channelRanges[channel];\n\n if (value === undefined) {\n throw new Error(`Unknown color channel: ${channel}`);\n }\n\n return value;\n }\n\n private readonly channelFormatOptions: Partial<\n Record<ColorChannel, Intl.NumberFormatOptions>\n > = {\n alpha: { style: \"percent\" },\n blue: { style: \"decimal\" },\n green: { style: \"decimal\" },\n red: { style: \"decimal\" },\n };\n\n getChannelFormatOptions(channel: ColorChannel): Intl.NumberFormatOptions {\n const value = this.channelFormatOptions[channel];\n\n if (value === undefined) {\n throw new Error(`Unknown color channel: ${channel}`);\n }\n\n return value;\n }\n\n formatChannelValue(channel: ColorChannel, locale: string) {\n const options = this.getChannelFormatOptions(channel);\n const value = this.getChannelValue(channel);\n\n return new NumberFormatter(locale, options).format(value);\n }\n\n private readonly colorSpace: ColorSpace = \"rgb\";\n\n getColorSpace(): ColorSpace {\n return this.colorSpace;\n }\n\n static colorChannels: [ColorChannel, ColorChannel, ColorChannel] = [\n \"red\",\n \"green\",\n \"blue\",\n ];\n private readonly colorChannels = RGBColor.colorChannels;\n\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uBAEI;GACF,OAAO,EAAE,OAAO,UAAU;GAC1B,MAAM,EAAE,OAAO,UAAU;GACzB,OAAO,EAAE,OAAO,UAAU;GAC1B,KAAK,EAAE,OAAO,UAAU;EAC1B;EAEA,wBAAwB,SAAiD;GACvE,MAAM,QAAQ,KAAK,qBAAqB;GAExC,IAAI,UAAU,KAAA,GACZ,MAAM,IAAI,MAAM,0BAA0B,SAAS;GAGrD,OAAO;EACT;EAEA,mBAAmB,SAAuB,QAAgB;GACxD,MAAM,UAAU,KAAK,wBAAwB,OAAO;GACpD,MAAM,QAAQ,KAAK,gBAAgB,OAAO;GAE1C,OAAO,IAAI,gBAAgB,QAAQ,OAAO,CAAC,CAAC,OAAO,KAAK;EAC1D;EAEA,aAA0C;EAE1C,gBAA4B;GAC1B,OAAO,KAAK;EACd;EAEA,OAAO,gBAA4D;GACjE;GACA;GACA;EACF;EACA,gBAAiC,SAAS;EAE1C,mBAA+D;GAC7D,OAAO,KAAK;EACd;CACF;AACF"}
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+ /*
13
+ * Derived from Adobe React Spectrum: packages/react-stately/src/color/Color.ts.
14
+ * Modified for Solid Aria: reorganized color code, type declarations, imports, and formatting.
15
+ * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.
16
+ */
17
+ import { Color, ColorChannel, ColorSpace } from "./types.js";
18
+ import { normalizeHue } from "./color/normalize-hue.js";
19
+ /** Parses a color from a string value. Throws an error if the string could not be parsed. */
20
+ export declare function parseColor(value: string): Color;
21
+ export declare function normalizeColor(v: string | Color): Color;
22
+ /** Returns a list of color channels for a given color space. */
23
+ export declare function getColorChannels(colorSpace: ColorSpace): [ColorChannel, ColorChannel, ColorChannel];
24
+ export { normalizeHue };
25
+ //# sourceMappingURL=color.d.ts.map
@@ -0,0 +1,41 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+ /*
13
+ * Derived from Adobe React Spectrum: packages/react-stately/src/color/Color.ts.
14
+ * Modified for Solid Aria: reorganized color code, type declarations, imports, and formatting.
15
+ * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.
16
+ */
17
+ import { normalizeHue } from "./color/normalize-hue.js";
18
+ import { HSBColor, HSLColor, RGBColor } from "./color/color-classes.js";
19
+ // src/color/color.ts
20
+ /** Parses a color from a string value. Throws an error if the string could not be parsed. */
21
+ function parseColor(value) {
22
+ const res = RGBColor.parse(value) ?? HSBColor.parse(value) ?? HSLColor.parse(value);
23
+ if (res) return res;
24
+ throw new Error(`Invalid color value: ${value}`);
25
+ }
26
+ function normalizeColor(v) {
27
+ if (typeof v === "string") return parseColor(v);
28
+ return v;
29
+ }
30
+ /** Returns a list of color channels for a given color space. */
31
+ function getColorChannels(colorSpace) {
32
+ switch (colorSpace) {
33
+ case "rgb": return RGBColor.colorChannels;
34
+ case "hsl": return HSLColor.colorChannels;
35
+ case "hsb": return HSBColor.colorChannels;
36
+ default: return RGBColor.colorChannels;
37
+ }
38
+ }
39
+ export { getColorChannels, normalizeColor, normalizeHue, parseColor };
40
+
41
+ //# sourceMappingURL=color.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color.js","names":[],"sources":["../../src/color/color.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/*\n * Derived from Adobe React Spectrum: packages/react-stately/src/color/Color.ts.\n * Modified for Solid Aria: reorganized color code, type declarations, imports, and formatting.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport { RGBColor, HSBColor, HSLColor } from \"./color/color-classes\";\nimport type { ColorChannel, ColorSpace, Color as IColor } from \"./types\";\n\nexport { normalizeHue } from \"./color/normalize-hue\";\n\n/** Parses a color from a string value. Throws an error if the string could not be parsed. */\nexport function parseColor(value: string): IColor {\n const res =\n RGBColor.parse(value) ?? HSBColor.parse(value) ?? HSLColor.parse(value);\n\n if (res) {\n return res;\n }\n\n throw new Error(`Invalid color value: ${value}`);\n}\n\nexport function normalizeColor(v: string | IColor): IColor {\n if (typeof v === \"string\") {\n return parseColor(v);\n }\n\n return v;\n}\n\n/** Returns a list of color channels for a given color space. */\nexport function getColorChannels(\n colorSpace: ColorSpace\n): [ColorChannel, ColorChannel, ColorChannel] {\n switch (colorSpace) {\n case \"rgb\": {\n return RGBColor.colorChannels;\n }\n\n case \"hsl\": {\n return HSLColor.colorChannels;\n }\n\n case \"hsb\": {\n return HSBColor.colorChannels;\n }\n\n default: {\n return RGBColor.colorChannels;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,WAAW,OAAuB;CAChD,MAAM,MACJ,SAAS,MAAM,KAAK,KAAK,SAAS,MAAM,KAAK,KAAK,SAAS,MAAM,KAAK;CAExE,IAAI,KACF,OAAO;CAGT,MAAM,IAAI,MAAM,wBAAwB,OAAO;AACjD;AAEA,SAAgB,eAAe,GAA4B;CACzD,IAAI,OAAO,MAAM,UACf,OAAO,WAAW,CAAC;CAGrB,OAAO;AACT;;AAGA,SAAgB,iBACd,YAC4C;CAC5C,QAAQ,YAAR;EACE,KAAK,OACH,OAAO,SAAS;EAGlB,KAAK,OACH,OAAO,SAAS;EAGlB,KAAK,OACH,OAAO,SAAS;EAGlB,SACE,OAAO,SAAS;CAEpB;AACF"}
@@ -0,0 +1,105 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+ /*
13
+ * Derived from Adobe React Spectrum: packages/react-stately/src/color/useColorAreaState.ts.
14
+ * Modified for Solid Aria: adapted reactive state and public APIs for Solid 2.
15
+ * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.
16
+ */
17
+ import { Color, ColorChannel, ColorSpace } from "./types.js";
18
+ import { ValueBase } from "@solid2-aria/types-shared";
19
+ export interface ColorAreaProps extends Omit<ValueBase<string | Color>, "onChange"> {
20
+ /**
21
+ * The color space that the color area operates in. The `xChannel` and `yChannel` must be in this
22
+ * color space. If not provided, this defaults to the color space of the `color` or `defaultColor`
23
+ * value.
24
+ */
25
+ colorSpace?: ColorSpace;
26
+ /** Color channel for the horizontal axis. */
27
+ xChannel?: ColorChannel;
28
+ /** Color channel for the vertical axis. */
29
+ yChannel?: ColorChannel;
30
+ /** Whether the ColorArea is disabled. */
31
+ isDisabled?: boolean;
32
+ /** Handler that is called when the value changes, as the user drags. */
33
+ onChange?: (value: Color) => void;
34
+ /** Handler that is called when the user stops dragging. */
35
+ onChangeEnd?: (value: Color) => void;
36
+ }
37
+ export interface ColorAreaState {
38
+ /** The current color value displayed by the color area. */
39
+ readonly value: Color;
40
+ /** The default value of the color area. */
41
+ readonly defaultValue: Color;
42
+ /** Sets the current color value. If a string is passed, it will be parsed to a Color. */
43
+ setValue: (value: string | Color) => void;
44
+ /** The current value of the horizontal axis channel displayed by the color area. */
45
+ xValue: number;
46
+ /**
47
+ * Sets the value for the horizontal axis channel displayed by the color area, and triggers
48
+ * `onChange`.
49
+ */
50
+ setXValue: (value: number) => void;
51
+ /** The current value of the vertical axis channel displayed by the color area. */
52
+ yValue: number;
53
+ /**
54
+ * Sets the value for the vertical axis channel displayed by the color area, and triggers
55
+ * `onChange`.
56
+ */
57
+ setYValue: (value: number) => void;
58
+ /**
59
+ * Sets the x and y channels of the current color value based on a percentage of the width and
60
+ * height of the color area, and triggers `onChange`.
61
+ */
62
+ setColorFromPoint: (x: number, y: number) => void;
63
+ /**
64
+ * Returns the coordinates of the thumb relative to the upper left corner of the color area as a
65
+ * percentage.
66
+ */
67
+ getThumbPosition: () => {
68
+ x: number;
69
+ y: number;
70
+ };
71
+ /** Increments the value of the horizontal axis channel by the channel step or page amount. */
72
+ incrementX: (stepSize?: number) => void;
73
+ /** Decrements the value of the horizontal axis channel by the channel step or page amount. */
74
+ decrementX: (stepSize?: number) => void;
75
+ /** Increments the value of the vertical axis channel by the channel step or page amount. */
76
+ incrementY: (stepSize?: number) => void;
77
+ /** Decrements the value of the vertical axis channel by the channel step or page amount. */
78
+ decrementY: (stepSize?: number) => void;
79
+ /** Whether the color area is currently being dragged. */
80
+ readonly isDragging: boolean;
81
+ /** Sets whether the color area is being dragged. */
82
+ setDragging: (value: boolean) => void;
83
+ /** Returns the xChannel, yChannel and zChannel names based on the color value. */
84
+ channels: {
85
+ xChannel: ColorChannel;
86
+ yChannel: ColorChannel;
87
+ zChannel: ColorChannel;
88
+ };
89
+ /** The step value of the xChannel, used when incrementing and decrementing. */
90
+ xChannelStep: number;
91
+ /** The step value of the yChannel, used when incrementing and decrementing. */
92
+ yChannelStep: number;
93
+ /** The page step value of the xChannel, used when incrementing and decrementing. */
94
+ xChannelPageStep: number;
95
+ /** The page step value of the yChannel, used when incrementing and decrementing. */
96
+ yChannelPageStep: number;
97
+ /** Returns the color that should be displayed in the color area thumb instead of `value`. */
98
+ getDisplayColor: () => Color;
99
+ }
100
+ /**
101
+ * Provides state management for a color area component. Color area allows users to adjust two
102
+ * channels of an HSL, HSB or RGB color value against a two-dimensional gradient background.
103
+ */
104
+ export declare function createColorAreaState(props: ColorAreaProps): ColorAreaState;
105
+ //# sourceMappingURL=create-color-area-state.d.ts.map
@@ -0,0 +1,138 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+ /*
13
+ * Derived from Adobe React Spectrum: packages/react-stately/src/color/useColorAreaState.ts.
14
+ * Modified for Solid Aria: adapted reactive state and public APIs for Solid 2.
15
+ * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.
16
+ */
17
+ import { createControlledSignal } from "../utils/create-controlled-signal.js";
18
+ import { clamp, snapValueToStep } from "../utils/number.js";
19
+ import { normalizeColor, parseColor } from "./color.js";
20
+ import { createMemo, createSignal, untrack } from "solid-js";
21
+ // src/color/create-color-area-state.ts
22
+ const DEFAULT_COLOR = parseColor("#ffffff");
23
+ /**
24
+ * Provides state management for a color area component. Color area allows users to adjust two
25
+ * channels of an HSL, HSB or RGB color value against a two-dimensional gradient background.
26
+ */
27
+ function createColorAreaState(props) {
28
+ const defaultValue = () => props.defaultValue !== void 0 && props.defaultValue !== "" ? normalizeColor(props.defaultValue) : DEFAULT_COLOR;
29
+ const controlledValue = createMemo(() => props.value !== void 0 && props.value !== "" ? normalizeColor(props.value) : void 0);
30
+ const [colorValue, setColorState] = createControlledSignal(controlledValue, untrack(defaultValue), (v) => props.onChange?.(v));
31
+ const initialValue = untrack(colorValue);
32
+ const color = createMemo(() => props.colorSpace ? colorValue().toFormat(props.colorSpace) : colorValue());
33
+ const channels = createMemo(() => color().getColorSpaceAxes({
34
+ xChannel: props.xChannel,
35
+ yChannel: props.yChannel
36
+ }));
37
+ const xRange = () => color().getChannelRange(channels().xChannel);
38
+ const yRange = () => color().getChannelRange(channels().yChannel);
39
+ const xValue = () => color().getChannelValue(channels().xChannel);
40
+ const yValue = () => color().getChannelValue(channels().yChannel);
41
+ const [isDragging, setDragging] = createSignal(false);
42
+ let dragging = false;
43
+ let lastValue = untrack(color);
44
+ const setColor = (value) => {
45
+ lastValue = value;
46
+ setColorState(value);
47
+ };
48
+ const setXValue = (v) => {
49
+ if (v !== xValue()) setColor(color().withChannelValue(channels().xChannel, v));
50
+ };
51
+ const setYValue = (v) => {
52
+ if (v !== yValue()) setColor(color().withChannelValue(channels().yChannel, v));
53
+ };
54
+ const moveX = (amount) => {
55
+ const r = xRange();
56
+ setXValue(amount > 0 && xValue() + amount > r.maxValue ? r.maxValue : snapValueToStep(xValue() + amount, r.minValue, r.maxValue, r.step));
57
+ };
58
+ const moveY = (amount) => {
59
+ const r = yRange();
60
+ setYValue(amount > 0 && yValue() + amount > r.maxValue ? r.maxValue : snapValueToStep(yValue() + amount, r.minValue, r.maxValue, r.step));
61
+ };
62
+ return {
63
+ get channels() {
64
+ return channels();
65
+ },
66
+ decrementX(s = 1) {
67
+ moveX(-s);
68
+ },
69
+ decrementY(s = 1) {
70
+ moveY(-s);
71
+ },
72
+ get defaultValue() {
73
+ return props.value === void 0 ? defaultValue() : initialValue;
74
+ },
75
+ getDisplayColor() {
76
+ return color().withChannelValue("alpha", 1);
77
+ },
78
+ getThumbPosition() {
79
+ const x = xRange();
80
+ const y = yRange();
81
+ return {
82
+ x: (xValue() - x.minValue) / (x.maxValue - x.minValue),
83
+ y: 1 - (yValue() - y.minValue) / (y.maxValue - y.minValue)
84
+ };
85
+ },
86
+ incrementX(s = 1) {
87
+ moveX(s);
88
+ },
89
+ incrementY(s = 1) {
90
+ moveY(s);
91
+ },
92
+ get isDragging() {
93
+ return isDragging();
94
+ },
95
+ setColorFromPoint(x, y) {
96
+ const xr = xRange();
97
+ const yr = yRange();
98
+ const xv = snapValueToStep(xr.minValue + clamp(x, 0, 1) * (xr.maxValue - xr.minValue), xr.minValue, xr.maxValue, xr.step);
99
+ const yv = snapValueToStep(yr.minValue + (1 - clamp(y, 0, 1)) * (yr.maxValue - yr.minValue), yr.minValue, yr.maxValue, yr.step);
100
+ if (xv !== xValue() || yv !== yValue()) setColor(color().withChannelValue(channels().xChannel, xv).withChannelValue(channels().yChannel, yv));
101
+ },
102
+ setDragging(v) {
103
+ const wasDragging = dragging;
104
+ dragging = v;
105
+ if (wasDragging && !v) props.onChangeEnd?.(lastValue);
106
+ setDragging(v);
107
+ },
108
+ setValue(v) {
109
+ setColor(normalizeColor(v));
110
+ },
111
+ setXValue,
112
+ setYValue,
113
+ get value() {
114
+ return color();
115
+ },
116
+ get xChannelPageStep() {
117
+ return xRange().pageSize;
118
+ },
119
+ get xChannelStep() {
120
+ return xRange().step;
121
+ },
122
+ get xValue() {
123
+ return xValue();
124
+ },
125
+ get yChannelPageStep() {
126
+ return yRange().pageSize;
127
+ },
128
+ get yChannelStep() {
129
+ return yRange().step;
130
+ },
131
+ get yValue() {
132
+ return yValue();
133
+ }
134
+ };
135
+ }
136
+ export { createColorAreaState };
137
+
138
+ //# sourceMappingURL=create-color-area-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-color-area-state.js","names":[],"sources":["../../src/color/create-color-area-state.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/*\n * Derived from Adobe React Spectrum: packages/react-stately/src/color/useColorAreaState.ts.\n * Modified for Solid Aria: adapted reactive state and public APIs for Solid 2.\n * Licensed under Apache-2.0. See LICENSES/Apache-2.0.txt and NOTICE.txt at the repository root.\n */\n\nimport type { ValueBase } from \"@solid2-aria/types-shared\";\nimport { createMemo, createSignal, untrack } from \"solid-js\";\n\nimport { createControlledSignal } from \"../utils/create-controlled-signal\";\nimport { clamp, snapValueToStep } from \"../utils/number\";\nimport { normalizeColor, parseColor } from \"./color\";\nimport type { Color, ColorChannel, ColorSpace } from \"./types\";\n\nexport interface ColorAreaProps extends Omit<\n ValueBase<string | Color>,\n \"onChange\"\n> {\n /**\n * The color space that the color area operates in. The `xChannel` and `yChannel` must be in this\n * color space. If not provided, this defaults to the color space of the `color` or `defaultColor`\n * value.\n */\n colorSpace?: ColorSpace;\n /** Color channel for the horizontal axis. */\n xChannel?: ColorChannel;\n /** Color channel for the vertical axis. */\n yChannel?: ColorChannel;\n /** Whether the ColorArea is disabled. */\n isDisabled?: boolean;\n /** Handler that is called when the value changes, as the user drags. */\n onChange?: (value: Color) => void;\n /** Handler that is called when the user stops dragging. */\n onChangeEnd?: (value: Color) => void;\n}\n\nexport interface ColorAreaState {\n /** The current color value displayed by the color area. */\n readonly value: Color;\n /** The default value of the color area. */\n readonly defaultValue: Color;\n /** Sets the current color value. If a string is passed, it will be parsed to a Color. */\n setValue: (value: string | Color) => void;\n\n /** The current value of the horizontal axis channel displayed by the color area. */\n xValue: number;\n /**\n * Sets the value for the horizontal axis channel displayed by the color area, and triggers\n * `onChange`.\n */\n setXValue: (value: number) => void;\n\n /** The current value of the vertical axis channel displayed by the color area. */\n yValue: number;\n /**\n * Sets the value for the vertical axis channel displayed by the color area, and triggers\n * `onChange`.\n */\n setYValue: (value: number) => void;\n\n /**\n * Sets the x and y channels of the current color value based on a percentage of the width and\n * height of the color area, and triggers `onChange`.\n */\n setColorFromPoint: (x: number, y: number) => void;\n /**\n * Returns the coordinates of the thumb relative to the upper left corner of the color area as a\n * percentage.\n */\n getThumbPosition: () => { x: number; y: number };\n\n /** Increments the value of the horizontal axis channel by the channel step or page amount. */\n incrementX: (stepSize?: number) => void;\n /** Decrements the value of the horizontal axis channel by the channel step or page amount. */\n decrementX: (stepSize?: number) => void;\n\n /** Increments the value of the vertical axis channel by the channel step or page amount. */\n incrementY: (stepSize?: number) => void;\n /** Decrements the value of the vertical axis channel by the channel step or page amount. */\n decrementY: (stepSize?: number) => void;\n\n /** Whether the color area is currently being dragged. */\n readonly isDragging: boolean;\n /** Sets whether the color area is being dragged. */\n setDragging: (value: boolean) => void;\n\n /** Returns the xChannel, yChannel and zChannel names based on the color value. */\n channels: {\n xChannel: ColorChannel;\n yChannel: ColorChannel;\n zChannel: ColorChannel;\n };\n /** The step value of the xChannel, used when incrementing and decrementing. */\n xChannelStep: number;\n /** The step value of the yChannel, used when incrementing and decrementing. */\n yChannelStep: number;\n /** The page step value of the xChannel, used when incrementing and decrementing. */\n xChannelPageStep: number;\n /** The page step value of the yChannel, used when incrementing and decrementing. */\n yChannelPageStep: number;\n\n /** Returns the color that should be displayed in the color area thumb instead of `value`. */\n getDisplayColor: () => Color;\n}\n\nconst DEFAULT_COLOR = parseColor(\"#ffffff\");\n\n/**\n * Provides state management for a color area component. Color area allows users to adjust two\n * channels of an HSL, HSB or RGB color value against a two-dimensional gradient background.\n */\n\nexport function createColorAreaState(props: ColorAreaProps): ColorAreaState {\n const defaultValue = () =>\n props.defaultValue !== undefined && props.defaultValue !== \"\"\n ? normalizeColor(props.defaultValue)\n : DEFAULT_COLOR;\n\n const controlledValue = createMemo(() =>\n props.value !== undefined && props.value !== \"\"\n ? normalizeColor(props.value)\n : undefined\n );\n\n const [colorValue, setColorState] = createControlledSignal(\n controlledValue,\n untrack(defaultValue),\n (v) => props.onChange?.(v)\n );\n\n const initialValue = untrack(colorValue);\n\n const color = createMemo(() =>\n props.colorSpace ? colorValue().toFormat(props.colorSpace) : colorValue()\n );\n\n const channels = createMemo(() =>\n color().getColorSpaceAxes({\n xChannel: props.xChannel,\n yChannel: props.yChannel,\n })\n );\n\n const xRange = () => color().getChannelRange(channels().xChannel);\n const yRange = () => color().getChannelRange(channels().yChannel);\n const xValue = () => color().getChannelValue(channels().xChannel);\n const yValue = () => color().getChannelValue(channels().yChannel);\n const [isDragging, setDragging] = createSignal(false);\n let dragging = false;\n let lastValue = untrack(color);\n\n const setColor = (value: Color) => {\n lastValue = value;\n setColorState(value);\n };\n\n const setXValue = (v: number) => {\n if (v !== xValue()) {\n setColor(color().withChannelValue(channels().xChannel, v));\n }\n };\n\n const setYValue = (v: number) => {\n if (v !== yValue()) {\n setColor(color().withChannelValue(channels().yChannel, v));\n }\n };\n\n const moveX = (amount: number) => {\n const r = xRange();\n setXValue(\n amount > 0 && xValue() + amount > r.maxValue\n ? r.maxValue\n : snapValueToStep(xValue() + amount, r.minValue, r.maxValue, r.step)\n );\n };\n\n const moveY = (amount: number) => {\n const r = yRange();\n setYValue(\n amount > 0 && yValue() + amount > r.maxValue\n ? r.maxValue\n : snapValueToStep(yValue() + amount, r.minValue, r.maxValue, r.step)\n );\n };\n\n return {\n get channels() {\n return channels();\n },\n decrementX(s = 1) {\n moveX(-s);\n },\n decrementY(s = 1) {\n moveY(-s);\n },\n get defaultValue() {\n return props.value === undefined ? defaultValue() : initialValue;\n },\n getDisplayColor() {\n return color().withChannelValue(\"alpha\", 1);\n },\n getThumbPosition() {\n const x = xRange();\n const y = yRange();\n\n return {\n x: (xValue() - x.minValue) / (x.maxValue - x.minValue),\n y: 1 - (yValue() - y.minValue) / (y.maxValue - y.minValue),\n };\n },\n incrementX(s = 1) {\n moveX(s);\n },\n incrementY(s = 1) {\n moveY(s);\n },\n get isDragging() {\n return isDragging();\n },\n setColorFromPoint(x, y) {\n const xr = xRange();\n const yr = yRange();\n\n const xv = snapValueToStep(\n xr.minValue + clamp(x, 0, 1) * (xr.maxValue - xr.minValue),\n xr.minValue,\n xr.maxValue,\n xr.step\n );\n\n const yv = snapValueToStep(\n yr.minValue + (1 - clamp(y, 0, 1)) * (yr.maxValue - yr.minValue),\n yr.minValue,\n yr.maxValue,\n yr.step\n );\n\n if (xv !== xValue() || yv !== yValue()) {\n setColor(\n color()\n .withChannelValue(channels().xChannel, xv)\n .withChannelValue(channels().yChannel, yv)\n );\n }\n },\n setDragging(v) {\n const wasDragging = dragging;\n dragging = v;\n\n if (wasDragging && !v) {\n props.onChangeEnd?.(lastValue);\n }\n\n setDragging(v);\n },\n setValue(v) {\n setColor(normalizeColor(v));\n },\n setXValue,\n setYValue,\n get value() {\n return color();\n },\n get xChannelPageStep() {\n return xRange().pageSize;\n },\n get xChannelStep() {\n return xRange().step;\n },\n get xValue() {\n return xValue();\n },\n get yChannelPageStep() {\n return yRange().pageSize;\n },\n get yChannelStep() {\n return yRange().step;\n },\n get yValue() {\n return yValue();\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoHA,MAAM,gBAAgB,WAAW,SAAS;;;;;AAO1C,SAAgB,qBAAqB,OAAuC;CAC1E,MAAM,qBACJ,MAAM,iBAAiB,KAAA,KAAa,MAAM,iBAAiB,KACvD,eAAe,MAAM,YAAY,IACjC;CAEN,MAAM,kBAAkB,iBACtB,MA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