@proyecto-viviana/solid-stately 0.5.1 → 0.6.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (414) hide show
  1. package/LICENSE-APACHE-2.0 +201 -0
  2. package/NOTICE +91 -0
  3. package/dist/autocomplete/createAutocompleteState.d.ts +2 -1
  4. package/dist/autocomplete/createAutocompleteState.d.ts.map +1 -0
  5. package/dist/autocomplete/index.d.ts +1 -0
  6. package/dist/autocomplete/index.d.ts.map +1 -0
  7. package/dist/calendar/IncompleteDate.d.ts +2 -1
  8. package/dist/calendar/IncompleteDate.d.ts.map +1 -0
  9. package/dist/calendar/createCalendarState.d.ts +7 -8
  10. package/dist/calendar/createCalendarState.d.ts.map +1 -0
  11. package/dist/calendar/createDateFieldState.d.ts +4 -20
  12. package/dist/calendar/createDateFieldState.d.ts.map +1 -0
  13. package/dist/calendar/createDatePickerState.d.ts +2 -7
  14. package/dist/calendar/createDatePickerState.d.ts.map +1 -0
  15. package/dist/calendar/createRangeCalendarState.d.ts +7 -7
  16. package/dist/calendar/createRangeCalendarState.d.ts.map +1 -0
  17. package/dist/calendar/createTimeFieldState.d.ts +4 -23
  18. package/dist/calendar/createTimeFieldState.d.ts.map +1 -0
  19. package/dist/calendar/index.d.ts +1 -0
  20. package/dist/calendar/index.d.ts.map +1 -0
  21. package/dist/calendar/intl/index.d.ts +1 -0
  22. package/dist/calendar/intl/index.d.ts.map +1 -0
  23. package/dist/checkbox/createCheckboxGroupState.d.ts +1 -0
  24. package/dist/checkbox/createCheckboxGroupState.d.ts.map +1 -0
  25. package/dist/checkbox/index.d.ts +1 -0
  26. package/dist/checkbox/index.d.ts.map +1 -0
  27. package/dist/collections/ListCollection.d.ts +5 -0
  28. package/dist/collections/ListCollection.d.ts.map +1 -0
  29. package/dist/collections/createListState.d.ts +2 -6
  30. package/dist/collections/createListState.d.ts.map +1 -0
  31. package/dist/collections/createMenuState.d.ts +30 -13
  32. package/dist/collections/createMenuState.d.ts.map +1 -0
  33. package/dist/collections/createSelectionState.d.ts +2 -5
  34. package/dist/collections/createSelectionState.d.ts.map +1 -0
  35. package/dist/collections/getChildNodes.d.ts +6 -3
  36. package/dist/collections/getChildNodes.d.ts.map +1 -0
  37. package/dist/collections/index.d.ts +2 -1
  38. package/dist/collections/index.d.ts.map +1 -0
  39. package/dist/collections/types.d.ts +36 -2
  40. package/dist/collections/types.d.ts.map +1 -0
  41. package/dist/color/Color.d.ts +7 -1
  42. package/dist/color/Color.d.ts.map +1 -0
  43. package/dist/color/createColorAreaState.d.ts +2 -5
  44. package/dist/color/createColorAreaState.d.ts.map +1 -0
  45. package/dist/color/createColorFieldState.d.ts +2 -5
  46. package/dist/color/createColorFieldState.d.ts.map +1 -0
  47. package/dist/color/createColorSliderState.d.ts +2 -5
  48. package/dist/color/createColorSliderState.d.ts.map +1 -0
  49. package/dist/color/createColorWheelState.d.ts +2 -5
  50. package/dist/color/createColorWheelState.d.ts.map +1 -0
  51. package/dist/color/getColorChannels.d.ts +3 -0
  52. package/dist/color/getColorChannels.d.ts.map +1 -0
  53. package/dist/color/index.d.ts +2 -1
  54. package/dist/color/index.d.ts.map +1 -0
  55. package/dist/color/intl/index.d.ts +1 -0
  56. package/dist/color/intl/index.d.ts.map +1 -0
  57. package/dist/color/types.d.ts +2 -1
  58. package/dist/color/types.d.ts.map +1 -0
  59. package/dist/combobox/createComboBoxState.d.ts +4 -8
  60. package/dist/combobox/createComboBoxState.d.ts.map +1 -0
  61. package/dist/combobox/index.d.ts +1 -0
  62. package/dist/combobox/index.d.ts.map +1 -0
  63. package/dist/data/createAsyncList.d.ts +1 -7
  64. package/dist/data/createAsyncList.d.ts.map +1 -0
  65. package/dist/data/createListData.d.ts +1 -6
  66. package/dist/data/createListData.d.ts.map +1 -0
  67. package/dist/data/createTreeData.d.ts +1 -6
  68. package/dist/data/createTreeData.d.ts.map +1 -0
  69. package/dist/data/index.d.ts +1 -0
  70. package/dist/data/index.d.ts.map +1 -0
  71. package/dist/datepicker/index.d.ts +1 -0
  72. package/dist/datepicker/index.d.ts.map +1 -0
  73. package/dist/disclosure/createDisclosureState.d.ts +2 -5
  74. package/dist/disclosure/createDisclosureState.d.ts.map +1 -0
  75. package/dist/disclosure/index.d.ts +1 -0
  76. package/dist/disclosure/index.d.ts.map +1 -0
  77. package/dist/dnd/createDragState.d.ts +2 -6
  78. package/dist/dnd/createDragState.d.ts.map +1 -0
  79. package/dist/dnd/createDraggableCollectionState.d.ts +39 -10
  80. package/dist/dnd/createDraggableCollectionState.d.ts.map +1 -0
  81. package/dist/dnd/createDropState.d.ts +2 -6
  82. package/dist/dnd/createDropState.d.ts.map +1 -0
  83. package/dist/dnd/createDroppableCollectionState.d.ts +28 -11
  84. package/dist/dnd/createDroppableCollectionState.d.ts.map +1 -0
  85. package/dist/dnd/index.d.ts +3 -2
  86. package/dist/dnd/index.d.ts.map +1 -0
  87. package/dist/dnd/types.d.ts +17 -0
  88. package/dist/dnd/types.d.ts.map +1 -0
  89. package/dist/flags/flags.d.ts +5 -0
  90. package/dist/flags/flags.d.ts.map +1 -0
  91. package/dist/form/createFormValidationState.d.ts +2 -9
  92. package/{src → dist}/form/createFormValidationState.d.ts.map +1 -1
  93. package/dist/form/index.d.ts +1 -0
  94. package/dist/form/index.d.ts.map +1 -0
  95. package/dist/grid/createGridState.d.ts +3 -2
  96. package/dist/grid/createGridState.d.ts.map +1 -0
  97. package/dist/grid/index.d.ts +1 -0
  98. package/dist/grid/index.d.ts.map +1 -0
  99. package/dist/grid/types.d.ts +23 -1
  100. package/dist/grid/types.d.ts.map +1 -0
  101. package/dist/index.d.ts +4 -2
  102. package/dist/index.d.ts.map +1 -0
  103. package/dist/index.js +2030 -593
  104. package/dist/index.js.map +1 -1
  105. package/dist/menu/index.d.ts +2 -1
  106. package/dist/menu/index.d.ts.map +1 -0
  107. package/dist/numberfield/createNumberFieldState.d.ts +31 -6
  108. package/dist/numberfield/createNumberFieldState.d.ts.map +1 -0
  109. package/dist/numberfield/index.d.ts +1 -0
  110. package/dist/numberfield/index.d.ts.map +1 -0
  111. package/dist/overlays/createOverlayTriggerState.d.ts +12 -1
  112. package/dist/overlays/createOverlayTriggerState.d.ts.map +1 -0
  113. package/dist/overlays/index.d.ts +1 -0
  114. package/dist/overlays/index.d.ts.map +1 -0
  115. package/dist/private/flags/flags.js +26 -0
  116. package/dist/private/flags/flags.js.map +1 -0
  117. package/dist/radio/createRadioGroupState.d.ts +1 -0
  118. package/dist/radio/createRadioGroupState.d.ts.map +1 -0
  119. package/dist/radio/index.d.ts +1 -0
  120. package/dist/radio/index.d.ts.map +1 -0
  121. package/dist/searchfield/createSearchFieldState.d.ts +2 -5
  122. package/dist/searchfield/createSearchFieldState.d.ts.map +1 -0
  123. package/dist/searchfield/index.d.ts +1 -0
  124. package/dist/searchfield/index.d.ts.map +1 -0
  125. package/dist/select/createSelectState.d.ts +17 -6
  126. package/dist/select/createSelectState.d.ts.map +1 -0
  127. package/dist/select/index.d.ts +1 -0
  128. package/dist/select/index.d.ts.map +1 -0
  129. package/dist/selection/Selection.d.ts +2 -1
  130. package/dist/selection/Selection.d.ts.map +1 -0
  131. package/dist/selection/SelectionManager.d.ts +1 -19
  132. package/dist/selection/SelectionManager.d.ts.map +1 -0
  133. package/dist/selection/createMultipleSelectionState.d.ts +2 -13
  134. package/dist/selection/createMultipleSelectionState.d.ts.map +1 -0
  135. package/dist/selection/index.d.ts +1 -0
  136. package/dist/selection/index.d.ts.map +1 -0
  137. package/dist/slider/createSliderState.d.ts +2 -5
  138. package/dist/slider/createSliderState.d.ts.map +1 -0
  139. package/dist/slider/index.d.ts +1 -0
  140. package/dist/slider/index.d.ts.map +1 -0
  141. package/dist/ssr/index.d.ts +2 -7
  142. package/dist/ssr/index.d.ts.map +1 -0
  143. package/dist/steplist/createStepListState.d.ts +2 -5
  144. package/dist/steplist/createStepListState.d.ts.map +1 -0
  145. package/dist/steplist/index.d.ts +1 -0
  146. package/dist/steplist/index.d.ts.map +1 -0
  147. package/dist/table/TableCollection.d.ts +1 -0
  148. package/dist/table/TableCollection.d.ts.map +1 -0
  149. package/dist/table/createTableColumnResizeState.d.ts +2 -9
  150. package/dist/table/createTableColumnResizeState.d.ts.map +1 -0
  151. package/dist/table/createTableState.d.ts +2 -5
  152. package/dist/table/createTableState.d.ts.map +1 -0
  153. package/dist/table/createTreeGridState.d.ts +2 -8
  154. package/dist/table/createTreeGridState.d.ts.map +1 -0
  155. package/dist/table/index.d.ts +1 -0
  156. package/dist/table/index.d.ts.map +1 -0
  157. package/dist/table/types.d.ts +35 -1
  158. package/dist/table/types.d.ts.map +1 -0
  159. package/dist/tabs/createTabListState.d.ts +2 -5
  160. package/dist/tabs/createTabListState.d.ts.map +1 -0
  161. package/dist/tabs/index.d.ts +1 -0
  162. package/dist/tabs/index.d.ts.map +1 -0
  163. package/dist/textfield/createTextFieldState.d.ts +1 -0
  164. package/dist/textfield/createTextFieldState.d.ts.map +1 -0
  165. package/dist/textfield/index.d.ts +1 -0
  166. package/dist/textfield/index.d.ts.map +1 -0
  167. package/dist/toast/createToastState.d.ts +2 -5
  168. package/dist/toast/createToastState.d.ts.map +1 -0
  169. package/dist/toast/index.d.ts +1 -0
  170. package/dist/toast/index.d.ts.map +1 -0
  171. package/dist/toggle/createToggleGroupState.d.ts +1 -0
  172. package/dist/toggle/createToggleGroupState.d.ts.map +1 -0
  173. package/dist/toggle/createToggleState.d.ts +1 -0
  174. package/dist/toggle/createToggleState.d.ts.map +1 -0
  175. package/dist/toggle/index.d.ts +1 -0
  176. package/dist/toggle/index.d.ts.map +1 -0
  177. package/dist/tokenfield/TokenFieldValue.d.ts +72 -0
  178. package/dist/tokenfield/TokenFieldValue.d.ts.map +1 -0
  179. package/dist/tokenfield/createTokenFieldState.d.ts +33 -0
  180. package/dist/tokenfield/createTokenFieldState.d.ts.map +1 -0
  181. package/dist/tokenfield/index.d.ts +3 -0
  182. package/dist/tokenfield/index.d.ts.map +1 -0
  183. package/dist/tooltip/createTooltipTriggerState.d.ts +9 -8
  184. package/dist/tooltip/createTooltipTriggerState.d.ts.map +1 -0
  185. package/dist/tooltip/index.d.ts +1 -0
  186. package/dist/tooltip/index.d.ts.map +1 -0
  187. package/dist/tree/TreeCollection.d.ts +1 -0
  188. package/dist/tree/TreeCollection.d.ts.map +1 -0
  189. package/dist/tree/createTreeState.d.ts +2 -7
  190. package/{src → dist}/tree/createTreeState.d.ts.map +1 -1
  191. package/dist/tree/index.d.ts +1 -0
  192. package/dist/tree/index.d.ts.map +1 -0
  193. package/dist/tree/types.d.ts +19 -1
  194. package/dist/tree/types.d.ts.map +1 -0
  195. package/dist/utils/index.d.ts +3 -1
  196. package/dist/utils/index.d.ts.map +1 -0
  197. package/dist/utils/owner.d.ts +9 -0
  198. package/dist/utils/owner.d.ts.map +1 -0
  199. package/dist/utils/reactivity.d.ts +19 -0
  200. package/dist/utils/reactivity.d.ts.map +1 -0
  201. package/package.json +21 -9
  202. package/src/autocomplete/createAutocompleteState.ts +18 -4
  203. package/src/calendar/IncompleteDate.ts +15 -1
  204. package/src/calendar/createCalendarState.ts +194 -79
  205. package/src/calendar/createDateFieldState.ts +45 -31
  206. package/src/calendar/createDatePickerState.ts +32 -14
  207. package/src/calendar/createRangeCalendarState.ts +134 -73
  208. package/src/calendar/createTimeFieldState.ts +25 -6
  209. package/src/calendar/intl/index.ts +37 -2
  210. package/src/checkbox/createCheckboxGroupState.ts +29 -13
  211. package/src/collections/ListCollection.ts +31 -0
  212. package/src/collections/createListState.ts +23 -6
  213. package/src/collections/createMenuState.ts +59 -14
  214. package/src/collections/createSelectionState.ts +32 -12
  215. package/src/collections/getChildNodes.ts +20 -3
  216. package/src/collections/index.ts +2 -0
  217. package/src/collections/types.ts +35 -2
  218. package/src/color/Color.ts +61 -22
  219. package/src/color/createColorAreaState.ts +29 -4
  220. package/src/color/createColorFieldState.ts +37 -11
  221. package/src/color/createColorSliderState.ts +36 -7
  222. package/src/color/createColorWheelState.ts +20 -4
  223. package/src/color/getColorChannels.ts +16 -0
  224. package/src/color/index.ts +1 -0
  225. package/src/color/intl/index.ts +38 -3
  226. package/src/color/types.ts +1 -1
  227. package/src/combobox/createComboBoxState.ts +178 -195
  228. package/src/data/createAsyncList.ts +22 -2
  229. package/src/data/createListData.ts +19 -2
  230. package/src/data/createTreeData.ts +19 -3
  231. package/src/disclosure/createDisclosureState.ts +40 -19
  232. package/src/dnd/createDragState.ts +22 -4
  233. package/src/dnd/createDraggableCollectionState.ts +137 -10
  234. package/src/dnd/createDropState.ts +21 -3
  235. package/src/dnd/createDroppableCollectionState.ts +117 -11
  236. package/src/dnd/index.ts +4 -0
  237. package/src/dnd/types.ts +16 -0
  238. package/src/flags/flags.ts +25 -0
  239. package/src/form/createFormValidationState.ts +54 -36
  240. package/src/grid/createGridState.ts +187 -109
  241. package/src/grid/types.ts +22 -1
  242. package/src/index.ts +15 -0
  243. package/src/menu/index.ts +2 -0
  244. package/src/numberfield/createNumberFieldState.ts +153 -66
  245. package/src/overlays/createOverlayTriggerState.ts +31 -4
  246. package/src/radio/createRadioGroupState.ts +19 -5
  247. package/src/searchfield/createSearchFieldState.ts +18 -3
  248. package/src/select/createSelectState.ts +73 -8
  249. package/src/selection/Selection.ts +15 -1
  250. package/src/selection/SelectionManager.ts +14 -0
  251. package/src/selection/createMultipleSelectionState.ts +44 -25
  252. package/src/slider/createSliderState.ts +20 -5
  253. package/src/ssr/index.ts +27 -4
  254. package/src/steplist/createStepListState.ts +38 -17
  255. package/src/table/TableCollection.ts +14 -0
  256. package/src/table/createTableColumnResizeState.ts +20 -3
  257. package/src/table/createTableState.ts +22 -1
  258. package/src/table/createTreeGridState.ts +21 -4
  259. package/src/table/types.ts +36 -3
  260. package/src/tabs/createTabListState.ts +77 -34
  261. package/src/textfield/createTextFieldState.ts +17 -3
  262. package/src/toast/createToastState.ts +28 -3
  263. package/src/toggle/createToggleGroupState.ts +20 -5
  264. package/src/toggle/createToggleState.ts +19 -4
  265. package/src/tokenfield/TokenFieldValue.ts +440 -0
  266. package/src/tokenfield/createTokenFieldState.ts +88 -0
  267. package/src/tokenfield/index.ts +14 -0
  268. package/src/tooltip/createTooltipTriggerState.ts +49 -13
  269. package/src/tree/TreeCollection.ts +14 -0
  270. package/src/tree/createTreeState.ts +62 -35
  271. package/src/tree/types.ts +18 -1
  272. package/src/utils/index.ts +9 -1
  273. package/src/utils/owner.ts +20 -0
  274. package/src/utils/reactivity.ts +45 -1
  275. package/src/autocomplete/createAutocompleteState.d.ts +0 -48
  276. package/src/autocomplete/createAutocompleteState.d.ts.map +0 -1
  277. package/src/autocomplete/index.d.ts +0 -6
  278. package/src/autocomplete/index.d.ts.map +0 -1
  279. package/src/calendar/createCalendarState.d.ts +0 -152
  280. package/src/calendar/createCalendarState.d.ts.map +0 -1
  281. package/src/calendar/createDateFieldState.d.ts +0 -145
  282. package/src/calendar/createDateFieldState.d.ts.map +0 -1
  283. package/src/calendar/createRangeCalendarState.d.ts +0 -171
  284. package/src/calendar/createRangeCalendarState.d.ts.map +0 -1
  285. package/src/calendar/createTimeFieldState.d.ts +0 -97
  286. package/src/calendar/createTimeFieldState.d.ts.map +0 -1
  287. package/src/calendar/index.d.ts +0 -80
  288. package/src/calendar/index.d.ts.map +0 -1
  289. package/src/checkbox/createCheckboxGroupState.d.ts +0 -73
  290. package/src/checkbox/createCheckboxGroupState.d.ts.map +0 -1
  291. package/src/checkbox/index.d.ts +0 -6
  292. package/src/checkbox/index.d.ts.map +0 -1
  293. package/src/collections/ListCollection.d.ts +0 -40
  294. package/src/collections/ListCollection.d.ts.map +0 -1
  295. package/src/collections/createListState.d.ts +0 -94
  296. package/src/collections/createListState.d.ts.map +0 -1
  297. package/src/collections/createMenuState.d.ts +0 -55
  298. package/src/collections/createMenuState.d.ts.map +0 -1
  299. package/src/collections/createSelectionState.d.ts +0 -89
  300. package/src/collections/createSelectionState.d.ts.map +0 -1
  301. package/src/collections/index.d.ts +0 -38
  302. package/src/collections/index.d.ts.map +0 -1
  303. package/src/collections/types.d.ts +0 -147
  304. package/src/collections/types.d.ts.map +0 -1
  305. package/src/color/Color.d.ts +0 -43
  306. package/src/color/Color.d.ts.map +0 -1
  307. package/src/color/createColorAreaState.d.ts +0 -78
  308. package/src/color/createColorAreaState.d.ts.map +0 -1
  309. package/src/color/createColorFieldState.d.ts +0 -57
  310. package/src/color/createColorFieldState.d.ts.map +0 -1
  311. package/src/color/createColorSliderState.d.ts +0 -69
  312. package/src/color/createColorSliderState.d.ts.map +0 -1
  313. package/src/color/createColorWheelState.d.ts +0 -53
  314. package/src/color/createColorWheelState.d.ts.map +0 -1
  315. package/src/color/index.d.ts +0 -39
  316. package/src/color/index.d.ts.map +0 -1
  317. package/src/color/types.d.ts +0 -111
  318. package/src/color/types.d.ts.map +0 -1
  319. package/src/combobox/createComboBoxState.d.ts +0 -127
  320. package/src/combobox/createComboBoxState.d.ts.map +0 -1
  321. package/src/combobox/index.d.ts +0 -13
  322. package/src/combobox/index.d.ts.map +0 -1
  323. package/src/disclosure/createDisclosureState.d.ts +0 -68
  324. package/src/disclosure/createDisclosureState.d.ts.map +0 -1
  325. package/src/disclosure/index.d.ts +0 -10
  326. package/src/disclosure/index.d.ts.map +0 -1
  327. package/src/dnd/createDragState.d.ts +0 -68
  328. package/src/dnd/createDragState.d.ts.map +0 -1
  329. package/src/dnd/createDraggableCollectionState.d.ts +0 -68
  330. package/src/dnd/createDraggableCollectionState.d.ts.map +0 -1
  331. package/src/dnd/createDropState.d.ts +0 -80
  332. package/src/dnd/createDropState.d.ts.map +0 -1
  333. package/src/dnd/createDroppableCollectionState.d.ts +0 -107
  334. package/src/dnd/createDroppableCollectionState.d.ts.map +0 -1
  335. package/src/dnd/index.d.ts +0 -60
  336. package/src/dnd/index.d.ts.map +0 -1
  337. package/src/dnd/types.d.ts +0 -277
  338. package/src/dnd/types.d.ts.map +0 -1
  339. package/src/form/createFormValidationState.d.ts +0 -102
  340. package/src/form/index.d.ts +0 -16
  341. package/src/form/index.d.ts.map +0 -1
  342. package/src/grid/createGridState.d.ts +0 -15
  343. package/src/grid/createGridState.d.ts.map +0 -1
  344. package/src/grid/index.d.ts +0 -7
  345. package/src/grid/index.d.ts.map +0 -1
  346. package/src/grid/types.d.ts +0 -163
  347. package/src/grid/types.d.ts.map +0 -1
  348. package/src/index.d.ts +0 -311
  349. package/src/index.d.ts.map +0 -1
  350. package/src/numberfield/createNumberFieldState.d.ts +0 -67
  351. package/src/numberfield/createNumberFieldState.d.ts.map +0 -1
  352. package/src/numberfield/index.d.ts +0 -6
  353. package/src/numberfield/index.d.ts.map +0 -1
  354. package/src/overlays/createOverlayTriggerState.d.ts +0 -34
  355. package/src/overlays/createOverlayTriggerState.d.ts.map +0 -1
  356. package/src/overlays/index.d.ts +0 -6
  357. package/src/overlays/index.d.ts.map +0 -1
  358. package/src/radio/createRadioGroupState.d.ts +0 -79
  359. package/src/radio/createRadioGroupState.d.ts.map +0 -1
  360. package/src/radio/index.d.ts +0 -7
  361. package/src/radio/index.d.ts.map +0 -1
  362. package/src/searchfield/createSearchFieldState.d.ts +0 -27
  363. package/src/searchfield/createSearchFieldState.d.ts.map +0 -1
  364. package/src/searchfield/index.d.ts +0 -3
  365. package/src/searchfield/index.d.ts.map +0 -1
  366. package/src/select/createSelectState.d.ts +0 -75
  367. package/src/select/createSelectState.d.ts.map +0 -1
  368. package/src/select/index.d.ts +0 -2
  369. package/src/select/index.d.ts.map +0 -1
  370. package/src/slider/createSliderState.d.ts +0 -72
  371. package/src/slider/createSliderState.d.ts.map +0 -1
  372. package/src/slider/index.d.ts +0 -3
  373. package/src/slider/index.d.ts.map +0 -1
  374. package/src/ssr/index.d.ts +0 -28
  375. package/src/ssr/index.d.ts.map +0 -1
  376. package/src/table/TableCollection.d.ts +0 -54
  377. package/src/table/TableCollection.d.ts.map +0 -1
  378. package/src/table/createTableState.d.ts +0 -15
  379. package/src/table/createTableState.d.ts.map +0 -1
  380. package/src/table/index.d.ts +0 -18
  381. package/src/table/index.d.ts.map +0 -1
  382. package/src/table/types.d.ts +0 -145
  383. package/src/table/types.d.ts.map +0 -1
  384. package/src/tabs/createTabListState.d.ts +0 -70
  385. package/src/tabs/createTabListState.d.ts.map +0 -1
  386. package/src/tabs/index.d.ts +0 -8
  387. package/src/tabs/index.d.ts.map +0 -1
  388. package/src/textfield/createTextFieldState.d.ts +0 -32
  389. package/src/textfield/createTextFieldState.d.ts.map +0 -1
  390. package/src/textfield/index.d.ts +0 -6
  391. package/src/textfield/index.d.ts.map +0 -1
  392. package/src/toast/createToastState.d.ts +0 -129
  393. package/src/toast/createToastState.d.ts.map +0 -1
  394. package/src/toast/index.d.ts +0 -12
  395. package/src/toast/index.d.ts.map +0 -1
  396. package/src/toggle/createToggleState.d.ts +0 -34
  397. package/src/toggle/createToggleState.d.ts.map +0 -1
  398. package/src/toggle/index.d.ts +0 -2
  399. package/src/toggle/index.d.ts.map +0 -1
  400. package/src/tooltip/createTooltipTriggerState.d.ts +0 -39
  401. package/src/tooltip/createTooltipTriggerState.d.ts.map +0 -1
  402. package/src/tooltip/index.d.ts +0 -7
  403. package/src/tooltip/index.d.ts.map +0 -1
  404. package/src/tree/TreeCollection.d.ts +0 -43
  405. package/src/tree/TreeCollection.d.ts.map +0 -1
  406. package/src/tree/createTreeState.d.ts +0 -17
  407. package/src/tree/index.d.ts +0 -13
  408. package/src/tree/index.d.ts.map +0 -1
  409. package/src/tree/types.d.ts +0 -162
  410. package/src/tree/types.d.ts.map +0 -1
  411. package/src/utils/index.d.ts +0 -2
  412. package/src/utils/index.d.ts.map +0 -1
  413. package/src/utils/reactivity.d.ts +0 -28
  414. package/src/utils/reactivity.d.ts.map +0 -1
@@ -1,9 +1,28 @@
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
+ // Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/menu/useMenuTriggerState.ts
14
+
1
15
  /**
2
16
  * State management for menu components.
3
- * Based on @react-stately/menu.
17
+ *
18
+ * createMenuTriggerState is ported from
19
+ * packages/react-stately/src/menu/useMenuTriggerState.ts.
20
+ * createMenuState is a local composition of the separately attributed list state.
4
21
  */
5
22
 
6
- import { access, type MaybeAccessor } from "../utils";
23
+ import { access, createInternalSignal, type MaybeAccessor } from "../utils";
24
+
25
+ import { createOverlayTriggerState, type OverlayTriggerProps } from "../overlays";
7
26
  import { createListState, type ListState, type ListStateProps } from "./createListState";
8
27
  import type { Key } from "./types";
9
28
 
@@ -84,32 +103,58 @@ export function createMenuState<T = unknown>(
84
103
  };
85
104
  }
86
105
 
87
- export interface MenuTriggerStateProps {
88
- /** Whether the menu is open (controlled). */
89
- isOpen?: boolean;
90
- /** Default open state (uncontrolled). */
91
- defaultOpen?: boolean;
92
- /** Handler called when the open state changes. */
93
- onOpenChange?: (isOpen: boolean) => void;
106
+ export type MenuTriggerType = "press" | "longPress" | "contextMenu";
107
+
108
+ export interface MenuTriggerProps extends OverlayTriggerProps {
109
+ /** How the menu is triggered. */
110
+ trigger?: MenuTriggerType;
94
111
  }
95
112
 
113
+ /** @deprecated Use `MenuTriggerProps`. */
114
+ export interface MenuTriggerStateProps extends MenuTriggerProps {}
115
+
96
116
  export interface MenuTriggerState {
97
117
  /** Whether the menu is open. */
98
118
  readonly isOpen: () => boolean;
119
+ /** Sets whether the menu is open. */
120
+ setOpen(isOpen: boolean): void;
99
121
  /** Open the menu. */
100
- open(): void;
122
+ open(focusStrategy?: "first" | "last" | null): void;
101
123
  /** Close the menu. */
102
124
  close(): void;
103
125
  /** Toggle the menu. */
104
- toggle(): void;
126
+ toggle(focusStrategy?: "first" | "last" | null): void;
105
127
  /** Focus strategy for when the menu opens. */
106
128
  readonly focusStrategy: () => "first" | "last" | null;
107
129
  /** Set the focus strategy. */
108
130
  setFocusStrategy(strategy: "first" | "last" | null): void;
131
+ /** Cursor position relative to the window viewport. */
132
+ readonly point: () => { x: number; y: number } | null;
133
+ /** Sets the cursor position relative to the window viewport. */
134
+ setPoint(point: { x: number; y: number }): void;
109
135
  }
110
136
 
111
137
  /**
112
- * Creates state for a menu trigger (button that opens a menu).
113
- * This is essentially the same as overlay trigger state but with focus strategy.
138
+ * Creates state for a menu trigger. Mirrors `@react-stately/menu` `useMenuTriggerState`:
139
+ * overlay open state plus the focus strategy passed through to `createMenu`.
114
140
  */
115
- export { createOverlayTriggerState as createMenuTriggerState } from "../overlays";
141
+ export function createMenuTriggerState(
142
+ props: MaybeAccessor<MenuTriggerProps> = {},
143
+ ): MenuTriggerState {
144
+ const overlay = createOverlayTriggerState(props);
145
+ const [focusStrategy, setFocusStrategy] = createInternalSignal<"first" | "last" | null>(null);
146
+
147
+ return {
148
+ ...overlay,
149
+ focusStrategy,
150
+ setFocusStrategy,
151
+ open(strategy: "first" | "last" | null = null) {
152
+ setFocusStrategy(strategy);
153
+ overlay.open();
154
+ },
155
+ toggle(strategy: "first" | "last" | null = null) {
156
+ setFocusStrategy(strategy);
157
+ overlay.toggle();
158
+ },
159
+ };
160
+ }
@@ -1,14 +1,31 @@
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
+ // Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/selection/SelectionManager.ts
14
+ // Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/selection/useMultipleSelectionState.ts
15
+
1
16
  /**
2
17
  * Selection state management for collections.
3
- * Based on @react-stately/selection.
18
+ * Ported from:
19
+ * - packages/react-stately/src/selection/useMultipleSelectionState.ts
20
+ * - packages/react-stately/src/selection/SelectionManager.ts
4
21
  */
5
22
 
6
- import { createSignal, createMemo, type Accessor } from "solid-js";
7
- import { access, type MaybeAccessor } from "../utils";
23
+ import { createMemo } from "solid-js";
24
+ import type { Accessor } from "solid-js";
25
+ import { access, createInternalSignal, readNow, type MaybeAccessor } from "../utils";
8
26
  import type {
9
27
  Collection,
10
28
  DisabledBehavior,
11
- FocusStrategy,
12
29
  Key,
13
30
  Selection,
14
31
  SelectionBehavior,
@@ -103,15 +120,15 @@ export function createSelectionState(
103
120
  const getProps = () => access(props);
104
121
 
105
122
  // Selection behavior state
106
- const [internalBehavior, setInternalBehavior] = createSignal<SelectionBehavior>("toggle");
123
+ const [internalBehavior, setInternalBehavior] = createInternalSignal<SelectionBehavior>("toggle");
107
124
 
108
125
  // Internal selection state
109
- const [internalSelectedKeys, setInternalSelectedKeys] = createSignal<Selection>(
126
+ const [internalSelectedKeys, setInternalSelectedKeys] = createInternalSignal<Selection>(
110
127
  getInitialSelection(getProps().defaultSelectedKeys),
111
128
  );
112
129
 
113
130
  // Track anchor for range selection
114
- const [anchorKey, setAnchorKey] = createSignal<Key | null>(null);
131
+ const [anchorKey, setAnchorKey] = createInternalSignal<Key | null>(null);
115
132
 
116
133
  // Computed values
117
134
  const selectionMode: Accessor<SelectionMode> = () => getProps().selectionMode ?? "none";
@@ -124,13 +141,13 @@ export function createSelectionState(
124
141
  return getProps().disallowEmptySelection ?? false;
125
142
  };
126
143
 
127
- const selectedKeys: Accessor<Selection> = createMemo(() => {
144
+ const selectedKeys: Accessor<Selection> = () => {
128
145
  const p = getProps();
129
146
  if (p.selectedKeys !== undefined) {
130
147
  return normalizeSelection(p.selectedKeys);
131
148
  }
132
149
  return internalSelectedKeys();
133
- });
150
+ };
134
151
 
135
152
  const disabledKeys: Accessor<Set<Key>> = createMemo(() => {
136
153
  const keys = getProps().disabledKeys;
@@ -151,8 +168,11 @@ export function createSelectionState(
151
168
  };
152
169
 
153
170
  // Methods
171
+ const liveSelectedKeys = (): Selection =>
172
+ getProps().selectedKeys !== undefined ? selectedKeys() : readNow(internalSelectedKeys);
173
+
154
174
  const isSelected = (key: Key): boolean => {
155
- const keys = selectedKeys();
175
+ const keys = liveSelectedKeys();
156
176
  if (keys === "all") return true;
157
177
  return keys.has(key);
158
178
  };
@@ -171,7 +191,7 @@ export function createSelectionState(
171
191
  }
172
192
 
173
193
  // Uncontrolled mode
174
- const current = internalSelectedKeys();
194
+ const current = readNow(internalSelectedKeys);
175
195
  const isDifferent =
176
196
  current === "all" ||
177
197
  newSelection === "all" ||
@@ -188,7 +208,7 @@ export function createSelectionState(
188
208
  if (isDisabled(key)) return;
189
209
  if (selectionMode() === "none") return;
190
210
 
191
- const current = selectedKeys();
211
+ const current = liveSelectedKeys();
192
212
 
193
213
  if (selectionMode() === "single") {
194
214
  if (isSelected(key) && !disallowEmptySelection()) {
@@ -1,7 +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
+ // Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/collections/getChildNodes.ts
14
+ // Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/collections/getItemCount.ts
15
+
1
16
  /**
2
17
  * Helpers for traversing collection nodes and comparing their document order.
3
18
  *
4
- * Based on @react-stately/collections.
19
+ * Ported from:
20
+ * - packages/react-stately/src/collections/getChildNodes.ts
21
+ * - packages/react-stately/src/collections/getItemCount.ts
5
22
  */
6
23
 
7
24
  import type { Collection, CollectionNode } from "./types";
@@ -51,8 +68,8 @@ const itemCountCache = new WeakMap<Collection<unknown>, number>();
51
68
 
52
69
  /**
53
70
  * Counts the item nodes (recursing into sections, ignoring section headers and
54
- * other non-item nodes) in a collection. Faithful port of
55
- * @react-stately/collections `getItemCount`; used by createOption to populate
71
+ * other non-item nodes) in a collection. Ported from
72
+ * packages/react-stately/src/collections/getItemCount.ts; used by createOption to populate
56
73
  * `aria-setsize` when the listbox is virtualized. Cached per (immutable)
57
74
  * collection identity, exactly like upstream.
58
75
  */
@@ -48,6 +48,8 @@ export {
48
48
  createMenuTriggerState,
49
49
  type MenuStateProps,
50
50
  type MenuState,
51
+ type MenuTriggerType,
52
+ type MenuTriggerProps,
51
53
  type MenuTriggerStateProps,
52
54
  type MenuTriggerState,
53
55
  } from "./createMenuState";
@@ -1,9 +1,42 @@
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
+ /*
14
+ * Copyright 2024 Adobe. All rights reserved.
15
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
16
+ * you may not use this file except in compliance with the License. You may obtain a copy
17
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
18
+ *
19
+ * Unless required by applicable law or agreed to in writing, software distributed under
20
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
21
+ * OF ANY KIND, either express or implied. See the License for the specific language
22
+ * governing permissions and limitations under the License.
23
+ */
24
+
25
+ // Ported to SolidJS for Proyecto Viviana; based on packages/@react-types/shared/src/collections.d.ts
26
+ // Ported to SolidJS for Proyecto Viviana; based on packages/@react-types/shared/src/selection.d.ts
27
+ // Ported to SolidJS for Proyecto Viviana; based on packages/react-aria/src/collections/BaseCollection.ts
28
+
1
29
  /**
2
30
  * Core types for collection state management.
3
- * Simplified from @react-stately/collections for SolidJS.
31
+ * Collection state types for SolidJS.
32
+ *
33
+ * Ported from:
34
+ * - packages/@react-types/shared/src/collections.d.ts
35
+ * - packages/@react-types/shared/src/selection.d.ts
36
+ * - packages/react-aria/src/collections/BaseCollection.ts
4
37
  */
5
38
 
6
- import type { JSX } from "solid-js";
39
+ import type { JSX } from "@solidjs/web";
7
40
 
8
41
  /** A unique identifier for an item in a collection. */
9
42
  export type Key = string | number;
@@ -1,6 +1,20 @@
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
+ // Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/color/Color.ts
14
+
1
15
  /**
2
16
  * Color class implementation.
3
- * Based on @react-stately/color.
17
+ * Ported from packages/react-stately/src/color/Color.ts.
4
18
  *
5
19
  * Provides color manipulation, conversion, and formatting.
6
20
  */
@@ -12,9 +26,6 @@ import type {
12
26
  ColorChannel,
13
27
  ColorChannelRange,
14
28
  ColorAxes,
15
- RGBColor,
16
- HSLColor,
17
- HSBColor,
18
29
  } from "./types";
19
30
  import { getColorStringForLocale, formatColorMessage, type ColorStringKey } from "./intl";
20
31
 
@@ -73,6 +84,17 @@ function clamp(value: number, min: number, max: number): number {
73
84
  return Math.min(Math.max(value, min), max);
74
85
  }
75
86
 
87
+ /**
88
+ * Normalizes a hue value to [0, 360).
89
+ * Preserves 360 so linear hue sliders can reach the end of their track.
90
+ */
91
+ export function normalizeHue(hue: number): number {
92
+ if (hue === 360) {
93
+ return hue;
94
+ }
95
+ return ((hue % 360) + 360) % 360;
96
+ }
97
+
76
98
  /**
77
99
  * Round to fixed decimal places.
78
100
  */
@@ -563,7 +585,7 @@ class HSLColorImpl implements Color {
563
585
  constructor(hue: number, saturation: number, lightness: number, alpha: number = 1) {
564
586
  // Store raw like upstream HSLColor's constructor — precision comes from the
565
587
  // conversion (toFixed(_, 2)); rounding to integers here diverged from S2.
566
- this.hue = clamp(hue % 360, 0, 360);
588
+ this.hue = clamp(normalizeHue(hue), 0, 360);
567
589
  this.saturation = clamp(saturation, 0, 100);
568
590
  this.lightness = clamp(lightness, 0, 100);
569
591
  this.alpha = clamp(toFixed(alpha, 2), 0, 1);
@@ -583,9 +605,16 @@ class HSLColorImpl implements Color {
583
605
  }
584
606
  case "hsb":
585
607
  case "hsba": {
586
- const { r, g, b } = hslToRgb(this.hue, this.saturation, this.lightness);
587
- const hsb = rgbToHsb(r, g, b);
588
- return new HSBColorImpl(hsb.h, hsb.s, hsb.b, this.alpha);
608
+ const saturation = this.saturation / 100;
609
+ const lightness = this.lightness / 100;
610
+ const brightness = lightness + saturation * Math.min(lightness, 1 - lightness);
611
+ const hsbSaturation = brightness === 0 ? 0 : 2 * (1 - lightness / brightness);
612
+ return new HSBColorImpl(
613
+ toFixed(this.hue, 2),
614
+ toFixed(hsbSaturation * 100, 2),
615
+ toFixed(brightness * 100, 2),
616
+ this.alpha,
617
+ );
589
618
  }
590
619
  default:
591
620
  throw new Error(`Unsupported format: ${format}`);
@@ -688,7 +717,7 @@ class HSLColorImpl implements Color {
688
717
  return { style: "percent" };
689
718
  }
690
719
  if (channel === "hue") {
691
- return { style: "unit", unit: "degree", unitDisplay: "narrow", maximumFractionDigits: 0 };
720
+ return { style: "unit", unit: "degree", unitDisplay: "narrow" };
692
721
  }
693
722
  return { style: "percent", maximumFractionDigits: 0 };
694
723
  }
@@ -738,7 +767,7 @@ class HSBColorImpl implements Color {
738
767
 
739
768
  constructor(hue: number, saturation: number, brightness: number, alpha: number = 1) {
740
769
  // Store raw like upstream HSBColor's constructor (see HSLColorImpl).
741
- this.hue = clamp(hue % 360, 0, 360);
770
+ this.hue = clamp(normalizeHue(hue), 0, 360);
742
771
  this.saturation = clamp(saturation, 0, 100);
743
772
  this.brightness = clamp(brightness, 0, 100);
744
773
  this.alpha = clamp(toFixed(alpha, 2), 0, 1);
@@ -758,9 +787,19 @@ class HSBColorImpl implements Color {
758
787
  }
759
788
  case "hsl":
760
789
  case "hsla": {
761
- const { r, g, b } = hsbToRgb(this.hue, this.saturation, this.brightness);
762
- const hsl = rgbToHsl(r, g, b);
763
- return new HSLColorImpl(hsl.h, hsl.s, hsl.l, this.alpha);
790
+ const saturation = this.saturation / 100;
791
+ const brightness = this.brightness / 100;
792
+ const lightness = brightness * (1 - saturation / 2);
793
+ const hslSaturation =
794
+ lightness === 0 || lightness === 1
795
+ ? 0
796
+ : (brightness - lightness) / Math.min(lightness, 1 - lightness);
797
+ return new HSLColorImpl(
798
+ toFixed(this.hue, 2),
799
+ toFixed(hslSaturation * 100, 2),
800
+ toFixed(lightness * 100, 2),
801
+ this.alpha,
802
+ );
764
803
  }
765
804
  default:
766
805
  throw new Error(`Unsupported format: ${format}`);
@@ -862,7 +901,7 @@ class HSBColorImpl implements Color {
862
901
  return { style: "percent" };
863
902
  }
864
903
  if (channel === "hue") {
865
- return { style: "unit", unit: "degree", unitDisplay: "narrow", maximumFractionDigits: 0 };
904
+ return { style: "unit", unit: "degree", unitDisplay: "narrow" };
866
905
  }
867
906
  return { style: "percent", maximumFractionDigits: 0 };
868
907
  }
@@ -956,24 +995,24 @@ export function parseColor(value: string): Color {
956
995
 
957
996
  // HSL/HSLA format
958
997
  const hslMatch = trimmed.match(
959
- /^hsla?\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(?:,\s*([\d.]+))?\s*\)$/,
998
+ /^hsla?\(\s*([-+]?\d+(?:\.\d+)?)\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*(?:,\s*([-+]?\d+(?:\.\d+)?))?\s*\)$/,
960
999
  );
961
1000
  if (hslMatch) {
962
- const h = parseInt(hslMatch[1], 10);
963
- const s = parseInt(hslMatch[2], 10);
964
- const l = parseInt(hslMatch[3], 10);
1001
+ const h = parseFloat(hslMatch[1]);
1002
+ const s = parseFloat(hslMatch[2]);
1003
+ const l = parseFloat(hslMatch[3]);
965
1004
  const a = hslMatch[4] !== undefined ? parseFloat(hslMatch[4]) : 1;
966
1005
  return new HSLColorImpl(h, s, l, a);
967
1006
  }
968
1007
 
969
1008
  // HSB/HSBA format
970
1009
  const hsbMatch = trimmed.match(
971
- /^hsba?\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(?:,\s*([\d.]+))?\s*\)$/,
1010
+ /^hsba?\(\s*([-+]?\d+(?:\.\d+)?)\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*(?:,\s*([-+]?\d+(?:\.\d+)?))?\s*\)$/,
972
1011
  );
973
1012
  if (hsbMatch) {
974
- const h = parseInt(hsbMatch[1], 10);
975
- const s = parseInt(hsbMatch[2], 10);
976
- const b = parseInt(hsbMatch[3], 10);
1013
+ const h = parseFloat(hsbMatch[1]);
1014
+ const s = parseFloat(hsbMatch[2]);
1015
+ const b = parseFloat(hsbMatch[3]);
977
1016
  const a = hsbMatch[4] !== undefined ? parseFloat(hsbMatch[4]) : 1;
978
1017
  return new HSBColorImpl(h, s, b, a);
979
1018
  }
@@ -1,11 +1,27 @@
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
+ // Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/color/useColorAreaState.ts
14
+
1
15
  /**
2
16
  * ColorArea state management.
3
17
  * Based on @react-stately/color useColorAreaState.
4
18
  */
5
19
 
6
- import { createSignal, createMemo, type Accessor } from "solid-js";
20
+ import { createMemo } from "solid-js";
21
+ import type { Accessor } from "solid-js";
7
22
  import type { Color, ColorChannel, ColorAxes, ColorSpace } from "./types";
8
23
  import { normalizeColor } from "./Color";
24
+ import { createInternalSignal } from "../utils";
9
25
 
10
26
  export interface ColorAreaStateOptions {
11
27
  /** The current color value (controlled). */
@@ -87,8 +103,8 @@ export function createColorAreaState(options: Accessor<ColorAreaStateOptions>):
87
103
  };
88
104
 
89
105
  // Internal value state
90
- const [internalValue, setInternalValue] = createSignal<Color | null>(null);
91
- const [isDragging, setIsDragging] = createSignal(false);
106
+ const [internalValue, setInternalValue] = createInternalSignal<Color | null>(null);
107
+ const [isDragging, setIsDragging] = createInternalSignal(false);
92
108
 
93
109
  // Initialize internal value
94
110
  const initValue = () => {
@@ -141,10 +157,13 @@ export function createColorAreaState(options: Accessor<ColorAreaStateOptions>):
141
157
  const xChannelPageStep = createMemo(() => xRange().pageSize);
142
158
  const yChannelPageStep = createMemo(() => yRange().pageSize);
143
159
 
160
+ let lastValue: Color | null = internalValue();
161
+
144
162
  // Update value
145
163
  const updateValue = (newColor: Color) => {
146
164
  const opts = getOptions();
147
165
  const nextColor = opts.colorSpace ? newColor.toFormat(opts.colorSpace) : newColor;
166
+ lastValue = nextColor;
148
167
 
149
168
  // Controlled mode
150
169
  if (opts.value !== undefined) {
@@ -245,7 +264,13 @@ export function createColorAreaState(options: Accessor<ColorAreaStateOptions>):
245
264
 
246
265
  // Call onChangeEnd when dragging ends
247
266
  if (wasDragging && !dragging) {
248
- getOptions().onChangeEnd?.(value());
267
+ const opts = getOptions();
268
+ const current =
269
+ lastValue ??
270
+ (opts.value !== undefined ? normalizeValue(opts.value) : null) ??
271
+ internalValue() ??
272
+ value();
273
+ opts.onChangeEnd?.(current);
249
274
  }
250
275
  };
251
276
 
@@ -1,11 +1,28 @@
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
+ // Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/color/useColorChannelFieldState.ts
14
+ // Ported to SolidJS for Proyecto Viviana; based on packages/react-stately/src/color/useColorFieldState.ts
15
+
1
16
  /**
2
17
  * ColorField state management.
3
18
  * Based on @react-stately/color useColorFieldState and useColorChannelFieldState.
4
19
  */
5
20
 
6
- import { createEffect, createMemo, createSignal, type Accessor } from "solid-js";
21
+ import { createEffect, createMemo } from "solid-js";
22
+ import type { Accessor } from "solid-js";
7
23
  import type { Color, ColorChannel, ColorChannelRange, ColorFormat, ColorSpace } from "./types";
8
24
  import { createRGBColor, normalizeColor, parseColor } from "./Color";
25
+ import { createInternalSignal, readNow } from "../utils";
9
26
 
10
27
  const HEX_COLOR_MAX = 0xffffff;
11
28
  const PARTIAL_HEX_PATTERN = /^#?[0-9a-f]{0,6}$/i;
@@ -145,7 +162,13 @@ function formatColorValue(
145
162
  return displayColor.formatChannelValue(channel, locale);
146
163
  }
147
164
 
148
- return displayColor.toString(format ?? "hex");
165
+ const formatted = displayColor.toString(format ?? "hex");
166
+ const resolvedFormat = format ?? "hex";
167
+ if (resolvedFormat === "hex" || resolvedFormat === "hexa") {
168
+ return formatted.toUpperCase();
169
+ }
170
+
171
+ return formatted;
149
172
  }
150
173
 
151
174
  function normalizeHexInput(value: string): string {
@@ -190,8 +213,8 @@ export function createColorFieldState(options: Accessor<ColorFieldStateOptions>)
190
213
  const initialOptions = getOptions();
191
214
  const initialValue = getDefaultValue(initialOptions);
192
215
 
193
- const [internalValue, setInternalValue] = createSignal<Color | null>(initialValue);
194
- const [inputValue, setInputValueInternal] = createSignal(
216
+ const [internalValue, setInternalValue] = createInternalSignal<Color | null>(initialValue);
217
+ const [inputValue, setInputValueInternal] = createInternalSignal(
195
218
  formatColorValue(
196
219
  initialValue,
197
220
  initialOptions.channel,
@@ -200,7 +223,7 @@ export function createColorFieldState(options: Accessor<ColorFieldStateOptions>)
200
223
  initialOptions.locale ?? "en-US",
201
224
  ),
202
225
  );
203
- const [invalidInput, setInvalidInput] = createSignal(false);
226
+ const [invalidInput, setInvalidInput] = createInternalSignal(false);
204
227
 
205
228
  const channel = createMemo(() => getOptions().channel);
206
229
  const colorSpace = createMemo(() => getOptions().colorSpace);
@@ -223,10 +246,13 @@ export function createColorFieldState(options: Accessor<ColorFieldStateOptions>)
223
246
  const formatCurrentValue = (color: Color | null = value()) =>
224
247
  formatColorValue(color, channel(), colorSpace(), getOptions().colorFormat, locale());
225
248
 
226
- createEffect(() => {
227
- setInputValueInternal(formatCurrentValue());
228
- setInvalidInput(false);
229
- });
249
+ createEffect(
250
+ () => formatCurrentValue(),
251
+ (formatted) => {
252
+ setInputValueInternal(formatted);
253
+ setInvalidInput(false);
254
+ },
255
+ );
230
256
 
231
257
  const updateValue = (newColor: Color | null) => {
232
258
  const opts = getOptions();
@@ -250,7 +276,7 @@ export function createColorFieldState(options: Accessor<ColorFieldStateOptions>)
250
276
  };
251
277
 
252
278
  const commit = () => {
253
- const text = inputValue().trim();
279
+ const text = readNow(inputValue).trim();
254
280
  const opts = getOptions();
255
281
  const chan = channel();
256
282
 
@@ -350,7 +376,7 @@ export function createColorFieldState(options: Accessor<ColorFieldStateOptions>)
350
376
  };
351
377
 
352
378
  const validate = (candidate?: string) => {
353
- const text = (candidate ?? inputValue()).trim();
379
+ const text = (candidate ?? readNow(inputValue)).trim();
354
380
  const chan = channel();
355
381
 
356
382
  if (!text) {