@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,136 @@
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/dnd/useDraggableCollectionState.ts.
14
+ * Modified for Solid Aria: adapted reactive state, getters, imports, and 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 { createMemo, createSignal, untrack } from "solid-js";
18
+ // src/dnd/create-draggable-collection-state.ts
19
+ /**
20
+ * Manages state for a draggable collection.
21
+ */
22
+ function createDraggableCollectionState(props) {
23
+ const getItems = createMemo(() => props.getItems);
24
+ const isDisabled = createMemo(() => props.isDisabled);
25
+ const collection = createMemo(() => props.collection);
26
+ const selectionManager = createMemo(() => props.selectionManager);
27
+ const onDragStart = createMemo(() => props.onDragStart);
28
+ const onDragMove = createMemo(() => props.onDragMove);
29
+ const onDragEnd = createMemo(() => props.onDragEnd);
30
+ const preview = createMemo(() => props.preview);
31
+ const getAllowedDropOperations = createMemo(() => props.getAllowedDropOperations);
32
+ const [dragging, setDragging] = createSignal(0, { ownedWrite: true });
33
+ let draggingKeys = untrack(() => /* @__PURE__ */ new Set());
34
+ let draggedKey = null;
35
+ const getKeys = (key) => {
36
+ const currentSelectionManager = selectionManager();
37
+ const currentCollection = collection();
38
+ const keys = /* @__PURE__ */ new Set();
39
+ if (currentSelectionManager.isSelected(key)) for (const currentKey of currentSelectionManager.selectedKeys) {
40
+ const node = currentCollection.getItem(currentKey);
41
+ if (node) {
42
+ let isChild = false;
43
+ let { parentKey } = node;
44
+ while (parentKey !== null && parentKey !== void 0) {
45
+ if (currentSelectionManager.selectedKeys.has(parentKey)) {
46
+ isChild = true;
47
+ break;
48
+ }
49
+ const parentNode = currentCollection.getItem(parentKey);
50
+ parentKey = parentNode ? parentNode.parentKey : null;
51
+ }
52
+ if (!isChild) keys.add(currentKey);
53
+ }
54
+ }
55
+ else keys.add(key);
56
+ return keys;
57
+ };
58
+ return {
59
+ get collection() {
60
+ return collection();
61
+ },
62
+ get draggedKey() {
63
+ dragging();
64
+ return draggedKey;
65
+ },
66
+ get draggingKeys() {
67
+ dragging();
68
+ return draggingKeys;
69
+ },
70
+ endDrag(event) {
71
+ const currentOnDragEnd = onDragEnd();
72
+ const { isInternal } = event;
73
+ if (typeof currentOnDragEnd === "function") currentOnDragEnd({
74
+ ...event,
75
+ isInternal,
76
+ keys: draggingKeys
77
+ });
78
+ draggingKeys = /* @__PURE__ */ new Set();
79
+ draggedKey = null;
80
+ setDragging((previous) => previous + 1);
81
+ },
82
+ get getAllowedDropOperations() {
83
+ return getAllowedDropOperations();
84
+ },
85
+ getItems(key) {
86
+ const currentCollection = collection();
87
+ const currentGetItems = getItems();
88
+ const keys = getKeys(key);
89
+ const items = [];
90
+ for (const localKey of keys) {
91
+ const value = currentCollection.getItem(localKey)?.value;
92
+ if (value !== null && value !== void 0) items.push(value);
93
+ }
94
+ return currentGetItems(getKeys(key), items);
95
+ },
96
+ get getKeysForDrag() {
97
+ return getKeys;
98
+ },
99
+ get isDisabled() {
100
+ return isDisabled();
101
+ },
102
+ isDragging(key) {
103
+ dragging();
104
+ return draggingKeys.has(key);
105
+ },
106
+ moveDrag(event) {
107
+ const currentOnDragMove = onDragMove();
108
+ if (typeof currentOnDragMove === "function") currentOnDragMove({
109
+ ...event,
110
+ keys: draggingKeys
111
+ });
112
+ },
113
+ get preview() {
114
+ return preview();
115
+ },
116
+ get selectionManager() {
117
+ return selectionManager();
118
+ },
119
+ startDrag(key, event) {
120
+ const currentSelectionManager = selectionManager();
121
+ const currentOnDragStart = onDragStart();
122
+ const keys = getKeys(key);
123
+ draggingKeys = keys;
124
+ draggedKey = key;
125
+ currentSelectionManager.setFocused(false);
126
+ setDragging((previous) => previous + 1);
127
+ if (typeof currentOnDragStart === "function") currentOnDragStart({
128
+ ...event,
129
+ keys
130
+ });
131
+ }
132
+ };
133
+ }
134
+ export { createDraggableCollectionState };
135
+
136
+ //# sourceMappingURL=create-draggable-collection-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-draggable-collection-state.js","names":[],"sources":["../../src/dnd/create-draggable-collection-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/dnd/useDraggableCollectionState.ts.\n * Modified for Solid Aria: adapted reactive state, getters, imports, and 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 {\n Collection,\n DraggableCollectionEndEvent,\n DraggableCollectionProps,\n DragItem,\n DragMoveEvent,\n DragPreviewRenderer,\n DragStartEvent,\n DropOperation,\n Key,\n Node,\n} from \"@solid2-aria/types-shared\";\nimport type { Accessor } from \"solid-js\";\nimport { createMemo, createSignal, untrack } from \"solid-js\";\n\nimport type { MultipleSelectionManager } from \"../selection/types\";\n\nexport interface DraggableCollectionStateOptions<\n T = object,\n> extends DraggableCollectionProps<T> {\n /** A collection of items. */\n collection: Collection<Node<T>>;\n /** An interface for reading and updating multiple selection state. */\n selectionManager: MultipleSelectionManager;\n /** Whether the drag events should be disabled. */\n isDisabled?: boolean;\n}\n\nexport interface DraggableCollectionState {\n /** A collection of items. */\n collection: Collection<Node<unknown>>;\n /** An interface for reading and updating multiple selection state. */\n selectionManager: MultipleSelectionManager;\n /** The key of the item that initiated a drag. */\n draggedKey: Key | null;\n /** The keys of the items that are currently being dragged. */\n draggingKeys: Set<Key>;\n /** Whether drag events are disabled. */\n isDisabled?: boolean;\n /** Returns whether the given key is currently being dragged. */\n isDragging: (key: Key) => boolean;\n /** Returns the keys of the items that will be dragged with the given key (e.g. selected items). */\n getKeysForDrag: (key: Key) => Set<Key>;\n /** Returns the items to drag for the given key. */\n getItems: (key: Key) => DragItem[];\n /** The ref of the element that will be rendered as the drag preview while dragging. */\n preview?: Accessor<DragPreviewRenderer | null>;\n /**\n * Function that returns the drop operations that are allowed for the dragged items. If not\n * provided, all drop operations are allowed.\n */\n getAllowedDropOperations?: () => DropOperation[];\n /** Begins a drag for the given key. This triggers the onDragStart event. */\n startDrag: (key: Key, event: DragStartEvent) => void;\n /** Triggers an onDragMove event. */\n moveDrag: (event: DragMoveEvent) => void;\n /** Ends the current drag, and emits an onDragEnd event. */\n endDrag: (event: DraggableCollectionEndEvent) => void;\n}\n\n/**\n * Manages state for a draggable collection.\n */\nexport function createDraggableCollectionState<T = object>(\n props: DraggableCollectionStateOptions<T>\n): DraggableCollectionState {\n const getItems = createMemo(() => props.getItems);\n const isDisabled = createMemo(() => props.isDisabled);\n const collection = createMemo(() => props.collection);\n const selectionManager = createMemo(() => props.selectionManager);\n const onDragStart = createMemo(() => props.onDragStart);\n const onDragMove = createMemo(() => props.onDragMove);\n const onDragEnd = createMemo(() => props.onDragEnd);\n const preview = createMemo(() => props.preview);\n\n const getAllowedDropOperations = createMemo(\n () => props.getAllowedDropOperations\n );\n\n const [dragging, setDragging] = createSignal(0, { ownedWrite: true });\n\n let draggingKeys = untrack(() => new Set<Key>());\n let draggedKey: Key | null = null;\n\n const getKeys = (key: Key) => {\n const currentSelectionManager = selectionManager();\n const currentCollection = collection();\n // The clicked item is always added to the drag. If it is selected, then all of the\n // other selected items are also dragged. If it is not selected, then only the clicked\n // item is dragged. This matches native macOS behavior.\n // Additionally, we filter out any keys that are children of any of the other selected keys\n const keys = new Set<Key>();\n\n if (currentSelectionManager.isSelected(key)) {\n for (const currentKey of currentSelectionManager.selectedKeys) {\n const node = currentCollection.getItem(currentKey);\n\n if (node) {\n let isChild = false;\n let { parentKey } = node;\n\n while (parentKey !== null && parentKey !== undefined) {\n if (currentSelectionManager.selectedKeys.has(parentKey)) {\n isChild = true;\n break;\n }\n\n const parentNode = currentCollection.getItem(parentKey);\n parentKey = parentNode ? parentNode.parentKey : null;\n }\n\n if (!isChild) {\n keys.add(currentKey);\n }\n }\n }\n } else {\n keys.add(key);\n }\n\n return keys;\n };\n\n return {\n get collection() {\n return collection();\n },\n get draggedKey() {\n dragging();\n\n return draggedKey;\n },\n get draggingKeys() {\n dragging();\n\n return draggingKeys;\n },\n endDrag(event) {\n const currentOnDragEnd = onDragEnd();\n const { isInternal } = event;\n\n if (typeof currentOnDragEnd === \"function\") {\n currentOnDragEnd({\n ...event,\n isInternal,\n keys: draggingKeys,\n });\n }\n\n draggingKeys = new Set();\n draggedKey = null;\n setDragging((previous) => previous + 1);\n },\n get getAllowedDropOperations() {\n return getAllowedDropOperations();\n },\n getItems(key) {\n const currentCollection = collection();\n const currentGetItems = getItems();\n const keys = getKeys(key);\n const items: T[] = [];\n\n for (const localKey of keys) {\n const value = currentCollection.getItem(localKey)?.value;\n\n if (value !== null && value !== undefined) {\n items.push(value);\n }\n }\n\n return currentGetItems(getKeys(key), items);\n },\n get getKeysForDrag() {\n return getKeys;\n },\n get isDisabled() {\n return isDisabled();\n },\n isDragging(key) {\n dragging();\n\n return draggingKeys.has(key);\n },\n moveDrag(event) {\n const currentOnDragMove = onDragMove();\n\n if (typeof currentOnDragMove === \"function\") {\n currentOnDragMove({\n ...event,\n keys: draggingKeys,\n });\n }\n },\n get preview() {\n return preview();\n },\n get selectionManager() {\n return selectionManager();\n },\n startDrag(key, event) {\n const currentSelectionManager = selectionManager();\n const currentOnDragStart = onDragStart();\n const keys = getKeys(key);\n draggingKeys = keys;\n draggedKey = key;\n currentSelectionManager.setFocused(false);\n setDragging((previous) => previous + 1);\n\n if (typeof currentOnDragStart === \"function\") {\n currentOnDragStart({\n ...event,\n keys,\n });\n }\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAgFA,SAAgB,+BACd,OAC0B;CAC1B,MAAM,WAAW,iBAAiB,MAAM,QAAQ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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/dnd/useDroppableCollectionState.ts.
14
+ * Modified for Solid Aria: adapted reactive state, getters, imports, and 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 { MultipleSelectionManager } from "../selection/types.js";
18
+ import { Collection, DragTypes, DropOperation, DropTarget, DroppableCollectionProps, Key, Node } from "@solid2-aria/types-shared";
19
+ interface DropOperationEvent {
20
+ target: DropTarget;
21
+ types: DragTypes;
22
+ allowedOperations: DropOperation[];
23
+ isInternal: boolean;
24
+ draggingKeys: Set<Key>;
25
+ }
26
+ export interface DroppableCollectionStateOptions extends Omit<DroppableCollectionProps, "onDropMove" | "onDropActivate"> {
27
+ /** A collection of items. */
28
+ collection: Collection<Node<unknown>>;
29
+ /** An interface for reading and updating multiple selection state. */
30
+ selectionManager: MultipleSelectionManager;
31
+ /** Whether the drop events should be disabled. */
32
+ isDisabled?: boolean;
33
+ }
34
+ export interface DroppableCollectionState {
35
+ /** A collection of items. */
36
+ collection: Collection<Node<unknown>>;
37
+ /** An interface for reading and updating multiple selection state. */
38
+ selectionManager: MultipleSelectionManager;
39
+ /** The current drop target. */
40
+ target: DropTarget | null;
41
+ /** Whether drop events are disabled. */
42
+ isDisabled?: boolean;
43
+ /** Sets the current drop target. */
44
+ setTarget: (target: DropTarget | null) => void;
45
+ /** Returns whether the given target is equivalent to the current drop target. */
46
+ isDropTarget: (target: DropTarget | null) => boolean;
47
+ /** Returns the drop operation for the given parameters. */
48
+ getDropOperation: (e: DropOperationEvent) => DropOperation;
49
+ }
50
+ /**
51
+ * Manages state for a droppable collection.
52
+ */
53
+ export declare function createDroppableCollectionState(props: DroppableCollectionStateOptions): DroppableCollectionState;
54
+ export {};
55
+ //# sourceMappingURL=create-droppable-collection-state.d.ts.map
@@ -0,0 +1,155 @@
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/dnd/useDroppableCollectionState.ts.
14
+ * Modified for Solid Aria: adapted reactive state, getters, imports, and 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 { createMemo, createSignal } from "solid-js";
18
+ // src/dnd/create-droppable-collection-state.ts
19
+ /**
20
+ * Manages state for a droppable collection.
21
+ */
22
+ function createDroppableCollectionState(props) {
23
+ const acceptedDragTypes = createMemo(() => props.acceptedDragTypes ?? "all");
24
+ const isDisabled = createMemo(() => props.isDisabled);
25
+ const onInsert = createMemo(() => props.onInsert);
26
+ const onRootDrop = createMemo(() => props.onRootDrop);
27
+ const onItemDrop = createMemo(() => props.onItemDrop);
28
+ const onReorder = createMemo(() => props.onReorder);
29
+ const onMove = createMemo(() => props.onMove);
30
+ const shouldAcceptItemDrop = createMemo(() => props.shouldAcceptItemDrop);
31
+ const collection = createMemo(() => props.collection);
32
+ const selectionManager = createMemo(() => props.selectionManager);
33
+ const onDropEnter = createMemo(() => props.onDropEnter);
34
+ const getDropOperation = createMemo(() => props.getDropOperation);
35
+ const onDrop = createMemo(() => props.onDrop);
36
+ const [target, setTarget] = createSignal(null, { ownedWrite: true });
37
+ let targetRef = null;
38
+ const getOppositeTarget = (localTarget) => {
39
+ const currentCollection = collection();
40
+ if (localTarget.dropPosition === "before") {
41
+ const node = currentCollection.getItem(localTarget.key);
42
+ return node && node.prevKey !== null && node.prevKey !== void 0 ? {
43
+ dropPosition: "after",
44
+ key: node.prevKey,
45
+ type: "item"
46
+ } : null;
47
+ } else if (localTarget.dropPosition === "after") {
48
+ const node = currentCollection.getItem(localTarget.key);
49
+ return node && node.nextKey !== null && node.nextKey !== void 0 ? {
50
+ dropPosition: "before",
51
+ key: node.nextKey,
52
+ type: "item"
53
+ } : null;
54
+ }
55
+ return null;
56
+ };
57
+ const defaultGetDropOperation = (e) => {
58
+ const currentIsDisabled = isDisabled();
59
+ const currentAcceptedDragTypes = acceptedDragTypes();
60
+ const initialOnInsert = onInsert();
61
+ const initialOnReorder = onReorder();
62
+ const initialCollection = collection();
63
+ const initialShouldAcceptItemDrop = shouldAcceptItemDrop();
64
+ const initialOnMove = onMove();
65
+ const initialOnRootDrop = onRootDrop();
66
+ const initialOnItemDrop = onItemDrop();
67
+ const currentOnDrop = onDrop();
68
+ const currentGetDropOperation = getDropOperation();
69
+ const { target: localTarget, types, allowedOperations, isInternal, draggingKeys } = e;
70
+ if (currentIsDisabled === true) return "cancel";
71
+ if (currentAcceptedDragTypes === "all" || currentAcceptedDragTypes.some((type) => types.has(type))) {
72
+ const isValidInsert = () => initialOnInsert && localTarget.type === "item" && !isInternal && (localTarget.dropPosition === "before" || localTarget.dropPosition === "after");
73
+ const isValidReorder = () => initialOnReorder && localTarget.type === "item" && isInternal && (localTarget.dropPosition === "before" || localTarget.dropPosition === "after") && isDraggingWithinParent(initialCollection, localTarget, draggingKeys);
74
+ const isItemDropAllowed = () => localTarget.type !== "item" || localTarget.dropPosition !== "on" || !initialShouldAcceptItemDrop || initialShouldAcceptItemDrop(localTarget, types);
75
+ const isValidMove = () => initialOnMove && localTarget.type === "item" && isInternal && isItemDropAllowed();
76
+ const isValidRootDrop = () => initialOnRootDrop && localTarget.type === "root" && !isInternal;
77
+ const isValidOnItemDrop = () => initialOnItemDrop && localTarget.type === "item" && localTarget.dropPosition === "on" && (!isInternal || localTarget.key === null || localTarget.key === void 0 || !draggingKeys.has(localTarget.key)) && isItemDropAllowed();
78
+ if (currentOnDrop || isValidInsert() === true || isValidReorder() === true || isValidMove() === true || isValidRootDrop() === true || isValidOnItemDrop() === true) {
79
+ if (currentGetDropOperation) return currentGetDropOperation(localTarget, types, allowedOperations);
80
+ return allowedOperations[0] ?? "cancel";
81
+ }
82
+ }
83
+ return "cancel";
84
+ };
85
+ return {
86
+ get collection() {
87
+ return collection();
88
+ },
89
+ getDropOperation(e) {
90
+ const currentCollection = collection();
91
+ const { target: localTarget, isInternal, draggingKeys } = e;
92
+ if (isInternal && localTarget.type === "item" && draggingKeys.size > 0) {
93
+ if (draggingKeys.has(localTarget.key) && localTarget.dropPosition === "on") return "cancel";
94
+ let currentKey = localTarget.key;
95
+ while (currentKey !== null && currentKey !== void 0) {
96
+ const parentKey = currentCollection.getItem(currentKey)?.parentKey;
97
+ if (parentKey !== null && parentKey !== void 0 && draggingKeys.has(parentKey)) return "cancel";
98
+ currentKey = parentKey ?? null;
99
+ }
100
+ }
101
+ return defaultGetDropOperation(e);
102
+ },
103
+ get isDisabled() {
104
+ return isDisabled();
105
+ },
106
+ isDropTarget(dropTarget) {
107
+ const localTarget = targetRef;
108
+ if (!localTarget || !dropTarget) return false;
109
+ if (isEqualDropTarget(dropTarget, localTarget)) return true;
110
+ if (dropTarget?.type === "item" && localTarget?.type === "item" && dropTarget.key !== localTarget.key && dropTarget.dropPosition !== localTarget.dropPosition && dropTarget.dropPosition !== "on" && localTarget.dropPosition !== "on") return isEqualDropTarget(getOppositeTarget(dropTarget), localTarget) || isEqualDropTarget(dropTarget, getOppositeTarget(localTarget));
111
+ return false;
112
+ },
113
+ get selectionManager() {
114
+ return selectionManager();
115
+ },
116
+ setTarget(newTarget) {
117
+ const currentOnDropEnter = onDropEnter();
118
+ if (this.isDropTarget(newTarget)) return;
119
+ const localTarget = targetRef;
120
+ if (localTarget && typeof props.onDropExit === "function") props.onDropExit({
121
+ target: localTarget,
122
+ type: "dropexit",
123
+ x: 0,
124
+ y: 0
125
+ });
126
+ if (newTarget && typeof currentOnDropEnter === "function") currentOnDropEnter({
127
+ target: newTarget,
128
+ type: "dropenter",
129
+ x: 0,
130
+ y: 0
131
+ });
132
+ targetRef = newTarget ?? null;
133
+ setTarget(newTarget ?? null);
134
+ },
135
+ get target() {
136
+ return target();
137
+ }
138
+ };
139
+ }
140
+ function isEqualDropTarget(a, b) {
141
+ if (!a) return !b;
142
+ switch (a.type) {
143
+ case "root": return b?.type === "root";
144
+ case "item": return b?.type === "item" && b?.key === a.key && b?.dropPosition === a.dropPosition;
145
+ }
146
+ return false;
147
+ }
148
+ function isDraggingWithinParent(collection, target, draggingKeys) {
149
+ const targetNode = collection.getItem(target.key);
150
+ for (const key of draggingKeys) if (collection.getItem(key)?.parentKey !== targetNode?.parentKey) return false;
151
+ return true;
152
+ }
153
+ export { createDroppableCollectionState };
154
+
155
+ //# sourceMappingURL=create-droppable-collection-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-droppable-collection-state.js","names":[],"sources":["../../src/dnd/create-droppable-collection-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/dnd/useDroppableCollectionState.ts.\n * Modified for Solid Aria: adapted reactive state, getters, imports, and 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 {\n Collection,\n DragTypes,\n DropOperation,\n DroppableCollectionProps,\n DropTarget,\n ItemDropTarget,\n Key,\n Node,\n} from \"@solid2-aria/types-shared\";\nimport { createMemo, createSignal } from \"solid-js\";\n\nimport type { MultipleSelectionManager } from \"../selection/types\";\n\ninterface DropOperationEvent {\n target: DropTarget;\n types: DragTypes;\n allowedOperations: DropOperation[];\n isInternal: boolean;\n draggingKeys: Set<Key>;\n}\n\nexport interface DroppableCollectionStateOptions extends Omit<\n DroppableCollectionProps,\n \"onDropMove\" | \"onDropActivate\"\n> {\n /** A collection of items. */\n collection: Collection<Node<unknown>>;\n /** An interface for reading and updating multiple selection state. */\n selectionManager: MultipleSelectionManager;\n /** Whether the drop events should be disabled. */\n isDisabled?: boolean;\n}\n\nexport interface DroppableCollectionState {\n /** A collection of items. */\n collection: Collection<Node<unknown>>;\n /** An interface for reading and updating multiple selection state. */\n selectionManager: MultipleSelectionManager;\n /** The current drop target. */\n target: DropTarget | null;\n /** Whether drop events are disabled. */\n isDisabled?: boolean;\n /** Sets the current drop target. */\n setTarget: (target: DropTarget | null) => void;\n /** Returns whether the given target is equivalent to the current drop target. */\n isDropTarget: (target: DropTarget | null) => boolean;\n /** Returns the drop operation for the given parameters. */\n getDropOperation: (e: DropOperationEvent) => DropOperation;\n}\n\n/**\n * Manages state for a droppable collection.\n */\nexport function createDroppableCollectionState(\n props: DroppableCollectionStateOptions\n): DroppableCollectionState {\n const acceptedDragTypes = createMemo(() => props.acceptedDragTypes ?? \"all\");\n const isDisabled = createMemo(() => props.isDisabled);\n const onInsert = createMemo(() => props.onInsert);\n const onRootDrop = createMemo(() => props.onRootDrop);\n const onItemDrop = createMemo(() => props.onItemDrop);\n const onReorder = createMemo(() => props.onReorder);\n const onMove = createMemo(() => props.onMove);\n const shouldAcceptItemDrop = createMemo(() => props.shouldAcceptItemDrop);\n const collection = createMemo(() => props.collection);\n const selectionManager = createMemo(() => props.selectionManager);\n const onDropEnter = createMemo(() => props.onDropEnter);\n const getDropOperation = createMemo(() => props.getDropOperation);\n const onDrop = createMemo(() => props.onDrop);\n\n const [target, setTarget] = createSignal<DropTarget | null>(null, {\n ownedWrite: true,\n });\n\n let targetRef: DropTarget | null = null;\n\n const getOppositeTarget = (\n localTarget: ItemDropTarget\n ): ItemDropTarget | null => {\n const currentCollection = collection();\n\n if (localTarget.dropPosition === \"before\") {\n const node = currentCollection.getItem(localTarget.key);\n\n return node && node.prevKey !== null && node.prevKey !== undefined\n ? { dropPosition: \"after\", key: node.prevKey, type: \"item\" }\n : null;\n } else if (localTarget.dropPosition === \"after\") {\n const node = currentCollection.getItem(localTarget.key);\n\n return node && node.nextKey !== null && node.nextKey !== undefined\n ? { dropPosition: \"before\", key: node.nextKey, type: \"item\" }\n : null;\n }\n\n return null;\n };\n\n const defaultGetDropOperation = (e: DropOperationEvent) => {\n const currentIsDisabled = isDisabled();\n const currentAcceptedDragTypes = acceptedDragTypes();\n const initialOnInsert = onInsert();\n const initialOnReorder = onReorder();\n const initialCollection = collection();\n const initialShouldAcceptItemDrop = shouldAcceptItemDrop();\n const initialOnMove = onMove();\n const initialOnRootDrop = onRootDrop();\n const initialOnItemDrop = onItemDrop();\n const currentOnDrop = onDrop();\n const currentGetDropOperation = getDropOperation();\n\n const {\n target: localTarget,\n types,\n allowedOperations,\n isInternal,\n draggingKeys,\n } = e;\n\n if (currentIsDisabled === true) {\n return \"cancel\";\n }\n\n if (\n currentAcceptedDragTypes === \"all\" ||\n currentAcceptedDragTypes.some((type) => types.has(type))\n ) {\n const isValidInsert = () =>\n initialOnInsert &&\n localTarget.type === \"item\" &&\n !isInternal &&\n (localTarget.dropPosition === \"before\" ||\n localTarget.dropPosition === \"after\");\n\n const isValidReorder = () =>\n initialOnReorder &&\n localTarget.type === \"item\" &&\n isInternal &&\n (localTarget.dropPosition === \"before\" ||\n localTarget.dropPosition === \"after\") &&\n isDraggingWithinParent(initialCollection, localTarget, draggingKeys);\n\n const isItemDropAllowed = () =>\n localTarget.type !== \"item\" ||\n localTarget.dropPosition !== \"on\" ||\n !initialShouldAcceptItemDrop ||\n initialShouldAcceptItemDrop(localTarget, types);\n\n const isValidMove = () =>\n initialOnMove &&\n localTarget.type === \"item\" &&\n isInternal &&\n isItemDropAllowed();\n\n // Feedback was that internal root drop was weird so preventing that from happening\n const isValidRootDrop = () =>\n initialOnRootDrop && localTarget.type === \"root\" && !isInternal;\n\n // Automatically prevent items (i.e. folders) from being dropped on themselves.\n const isValidOnItemDrop = () =>\n initialOnItemDrop &&\n localTarget.type === \"item\" &&\n localTarget.dropPosition === \"on\" &&\n (!isInternal ||\n localTarget.key === null ||\n localTarget.key === undefined ||\n !draggingKeys.has(localTarget.key)) &&\n isItemDropAllowed();\n\n if (\n currentOnDrop ||\n isValidInsert() === true ||\n isValidReorder() === true ||\n isValidMove() === true ||\n isValidRootDrop() === true ||\n isValidOnItemDrop() === true\n ) {\n if (currentGetDropOperation) {\n return currentGetDropOperation(localTarget, types, allowedOperations);\n }\n\n return allowedOperations[0] ?? \"cancel\";\n }\n }\n\n return \"cancel\";\n };\n\n return {\n get collection() {\n return collection();\n },\n getDropOperation(e) {\n const currentCollection = collection();\n const { target: localTarget, isInternal, draggingKeys } = e;\n\n // Prevent dropping items onto themselves or their descendants\n if (isInternal && localTarget.type === \"item\" && draggingKeys.size > 0) {\n if (\n draggingKeys.has(localTarget.key) &&\n localTarget.dropPosition === \"on\"\n ) {\n return \"cancel\";\n }\n\n let currentKey: Key | null = localTarget.key;\n\n while (currentKey !== null && currentKey !== undefined) {\n const item = currentCollection.getItem(currentKey);\n const parentKey = item?.parentKey;\n\n if (\n parentKey !== null &&\n parentKey !== undefined &&\n draggingKeys.has(parentKey)\n ) {\n return \"cancel\";\n }\n\n currentKey = parentKey ?? null;\n }\n }\n\n return defaultGetDropOperation(e);\n },\n get isDisabled() {\n return isDisabled();\n },\n isDropTarget(dropTarget) {\n const localTarget = targetRef;\n\n if (!localTarget || !dropTarget) {\n return false;\n }\n\n if (isEqualDropTarget(dropTarget, localTarget)) {\n return true;\n }\n\n // Check if the targets point at the same point between two items, one referring before, and the other after.\n if (\n dropTarget?.type === \"item\" &&\n localTarget?.type === \"item\" &&\n dropTarget.key !== localTarget.key &&\n dropTarget.dropPosition !== localTarget.dropPosition &&\n dropTarget.dropPosition !== \"on\" &&\n localTarget.dropPosition !== \"on\"\n ) {\n return (\n isEqualDropTarget(getOppositeTarget(dropTarget), localTarget) ||\n isEqualDropTarget(dropTarget, getOppositeTarget(localTarget))\n );\n }\n\n return false;\n },\n get selectionManager() {\n return selectionManager();\n },\n setTarget(newTarget) {\n const currentOnDropEnter = onDropEnter();\n\n if (this.isDropTarget(newTarget)) {\n return;\n }\n\n const localTarget = targetRef;\n\n if (localTarget && typeof props.onDropExit === \"function\") {\n props.onDropExit({\n target: localTarget,\n type: \"dropexit\",\n\n x: 0,\n y: 0,\n });\n }\n\n if (newTarget && typeof currentOnDropEnter === \"function\") {\n currentOnDropEnter({\n target: newTarget,\n type: \"dropenter\",\n\n x: 0,\n y: 0,\n });\n }\n\n targetRef = newTarget ?? null;\n setTarget(newTarget ?? null);\n },\n get target() {\n return target();\n },\n };\n}\n\nfunction isEqualDropTarget(a?: DropTarget | null, b?: DropTarget | null) {\n if (!a) {\n return !b;\n }\n\n switch (a.type) {\n case \"root\": {\n return b?.type === \"root\";\n }\n\n case \"item\": {\n return (\n b?.type === \"item\" &&\n b?.key === a.key &&\n b?.dropPosition === a.dropPosition\n );\n }\n\n default: {\n break;\n }\n }\n\n return false;\n}\n\nfunction isDraggingWithinParent(\n collection: Collection<Node<unknown>>,\n target: ItemDropTarget,\n draggingKeys: Set<Key>\n) {\n const targetNode = collection.getItem(target.key);\n\n for (const key of draggingKeys) {\n const node = collection.getItem(key);\n\n if (node?.parentKey !== targetNode?.parentKey) {\n return false;\n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BAAmB;IACjB,QAAQ;IACR,MAAM;IAEN,GAAG;IACH,GAAG;GACL,CAAC;GAGH,YAAY,aAAa;GACzB,UAAU,aAAa,IAAI;EAC7B;EACA,IAAI,SAAS;GACX,OAAO,OAAO;EAChB;CACF;AACF;AAEA,SAAS,kBAAkB,GAAuB,GAAuB;CACvE,IAAI,CAAC,GACH,OAAO,CAAC;CAGV,QAAQ,EAAE,MAAV;EACE,KAAK,QACH,OAAO,GAAG,SAAS;EAGrB,KAAK,QACH,OACE,GAAG,SAAS,UACZ,GAAG,QAAQ,EAAE,OACb,GAAG,iBAAiB,EAAE;CAO5B;CAEA,OAAO;AACT;AAEA,SAAS,uBACP,YACA,QACA,cACA;CACA,MAAM,aAAa,WAAW,QAAQ,OAAO,GAAG;CAEhD,KAAK,MAAM,OAAO,cAGhB,IAFa,WAAW,QAAQ,GAEzB,CAAC,EAAE,cAAc,YAAY,WAClC,OAAO;CAIX,OAAO;AACT"}
@@ -0,0 +1,21 @@
1
+ /*
2
+ * Copyright 2023 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/flags/flags.ts.
14
+ * Modified for Solid Aria: adapted reactive state, getters, imports, and 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
+ export declare function enableTableNestedRows(): void;
18
+ export declare function tableNestedRows(): boolean;
19
+ export declare function enableShadowDOM(): void;
20
+ export declare function shadowDOM(): boolean;
21
+ //# sourceMappingURL=flags.d.ts.map
@@ -0,0 +1,34 @@
1
+ /*
2
+ * Copyright 2023 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/flags/flags.ts.
14
+ * Modified for Solid Aria: adapted reactive state, getters, imports, and 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
+ // src/flags/flags.ts
18
+ let _tableNestedRows = false;
19
+ let _shadowDOM = false;
20
+ function enableTableNestedRows() {
21
+ _tableNestedRows = true;
22
+ }
23
+ function tableNestedRows() {
24
+ return _tableNestedRows;
25
+ }
26
+ function enableShadowDOM() {
27
+ _shadowDOM = true;
28
+ }
29
+ function shadowDOM() {
30
+ return _shadowDOM;
31
+ }
32
+ export { enableShadowDOM, enableTableNestedRows, shadowDOM, tableNestedRows };
33
+
34
+ //# sourceMappingURL=flags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flags.js","names":[],"sources":["../../src/flags/flags.ts"],"sourcesContent":["/*\n * Copyright 2023 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/flags/flags.ts.\n * Modified for Solid Aria: adapted reactive state, getters, imports, and 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\nlet _tableNestedRows = false;\nlet _shadowDOM = false;\n\nexport function enableTableNestedRows(): void {\n _tableNestedRows = true;\n}\n\nexport function tableNestedRows(): boolean {\n return _tableNestedRows;\n}\n\nexport function enableShadowDOM(): void {\n _shadowDOM = true;\n}\n\nexport function shadowDOM(): boolean {\n return _shadowDOM;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,IAAI,mBAAmB;AACvB,IAAI,aAAa;AAEjB,SAAgB,wBAA8B;CAC5C,mBAAmB;AACrB;AAEA,SAAgB,kBAA2B;CACzC,OAAO;AACT;AAEA,SAAgB,kBAAwB;CACtC,aAAa;AACf;AAEA,SAAgB,YAAqB;CACnC,OAAO;AACT"}
@@ -0,0 +1,37 @@
1
+ /*
2
+ * Copyright 2023 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/form/useFormValidationState.ts.
14
+ * Modified for Solid Aria: adapted state handling, APIs, or formatting 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 { Validation, ValidationErrors, ValidationResult } from "@solid2-aria/types-shared";
18
+ export declare const VALID_VALIDITY_STATE: ValidationResult["validationDetails"];
19
+ export declare const DEFAULT_VALIDATION_RESULT: ValidationResult;
20
+ export declare const FormValidationContext: import("solid-js").Context<ValidationErrors>;
21
+ export declare const privateValidationStateProp = "__solid2AriaFormValidationState";
22
+ export interface FormValidationProps<T> extends Validation<T> {
23
+ builtinValidation?: ValidationResult;
24
+ name?: string | string[];
25
+ value: T | null;
26
+ __solid2AriaFormValidationState?: FormValidationState;
27
+ }
28
+ export interface FormValidationState {
29
+ readonly realtimeValidation: ValidationResult;
30
+ readonly displayValidation: ValidationResult;
31
+ updateValidation: (result: ValidationResult) => void;
32
+ resetValidation: () => void;
33
+ commitValidation: () => void;
34
+ }
35
+ export declare function createFormValidationState<T>(props: FormValidationProps<T>): FormValidationState;
36
+ export declare function mergeValidation(...results: ValidationResult[]): ValidationResult;
37
+ //# sourceMappingURL=create-form-validation-state.d.ts.map
@@ -0,0 +1,152 @@
1
+ /*
2
+ * Copyright 2023 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/form/useFormValidationState.ts.
14
+ * Modified for Solid Aria: adapted state handling, APIs, or formatting 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 { getLegacyValidationState } from "../utils/legacy-props.js";
18
+ import { createContext, createEffect, createMemo, createSignal, untrack, useContext } from "solid-js";
19
+ // src/form/create-form-validation-state.ts
20
+ const VALID_VALIDITY_STATE = {
21
+ badInput: false,
22
+ customError: false,
23
+ patternMismatch: false,
24
+ rangeOverflow: false,
25
+ rangeUnderflow: false,
26
+ stepMismatch: false,
27
+ tooLong: false,
28
+ tooShort: false,
29
+ typeMismatch: false,
30
+ valid: true,
31
+ valueMissing: false
32
+ };
33
+ const CUSTOM_VALIDITY_STATE = {
34
+ badInput: false,
35
+ customError: true,
36
+ patternMismatch: false,
37
+ rangeOverflow: false,
38
+ rangeUnderflow: false,
39
+ stepMismatch: false,
40
+ tooLong: false,
41
+ tooShort: false,
42
+ typeMismatch: false,
43
+ valid: false,
44
+ valueMissing: false
45
+ };
46
+ const DEFAULT_VALIDATION_RESULT = {
47
+ isInvalid: false,
48
+ validationDetails: VALID_VALIDITY_STATE,
49
+ validationErrors: []
50
+ };
51
+ const FormValidationContext = createContext({});
52
+ const privateValidationStateProp = "__solid2AriaFormValidationState";
53
+ function result(errors) {
54
+ return errors.length ? {
55
+ isInvalid: true,
56
+ validationDetails: CUSTOM_VALIDITY_STATE,
57
+ validationErrors: errors
58
+ } : null;
59
+ }
60
+ function createFormValidationState(props) {
61
+ const inherited = untrack(() => props.__solid2AriaFormValidationState);
62
+ if (inherited) return inherited;
63
+ const serverErrors = useContext(FormValidationContext);
64
+ const [clearedErrors, setClearedErrors] = createSignal(null);
65
+ const [current, setCurrent] = createSignal(DEFAULT_VALIDATION_RESULT);
66
+ const [queued, setQueued] = createSignal(false);
67
+ let next = DEFAULT_VALIDATION_RESULT;
68
+ const controlled = createMemo(() => {
69
+ const legacyState = getLegacyValidationState(props);
70
+ const invalid = props.isInvalid ?? (legacyState === void 0 ? void 0 : legacyState === "invalid");
71
+ return invalid === void 0 ? null : {
72
+ isInvalid: invalid,
73
+ validationDetails: CUSTOM_VALIDITY_STATE,
74
+ validationErrors: []
75
+ };
76
+ });
77
+ const client = createMemo(() => {
78
+ const error = props.value === null ? null : props.validate?.(props.value);
79
+ if (typeof error === "string") return result([error]);
80
+ return result(Array.isArray(error) ? error : []);
81
+ });
82
+ const builtin = () => props.builtinValidation?.validationDetails.valid === true ? void 0 : props.builtinValidation;
83
+ const server = createMemo(() => {
84
+ if (props.name === void 0 || clearedErrors() === serverErrors) return null;
85
+ return result((Array.isArray(props.name) ? props.name : [props.name]).flatMap((name) => {
86
+ const e = serverErrors[name];
87
+ if (e === void 0) return [];
88
+ return Array.isArray(e) ? e : [e];
89
+ }));
90
+ });
91
+ createEffect(() => ({
92
+ error: client() ?? builtin() ?? next,
93
+ queued: queued()
94
+ }), ({ queued: shouldCommit, error }) => {
95
+ if (shouldCommit) {
96
+ setQueued(false);
97
+ setCurrent(error);
98
+ }
99
+ });
100
+ return {
101
+ commitValidation() {
102
+ if (props.validationBehavior === "native") setQueued(true);
103
+ setClearedErrors(serverErrors);
104
+ },
105
+ get displayValidation() {
106
+ return controlled() ?? server() ?? (props.validationBehavior === "native" ? current() : client() ?? builtin() ?? current());
107
+ },
108
+ get realtimeValidation() {
109
+ return controlled() ?? server() ?? client() ?? builtin() ?? DEFAULT_VALIDATION_RESULT;
110
+ },
111
+ resetValidation() {
112
+ setCurrent(DEFAULT_VALIDATION_RESULT);
113
+ setQueued(false);
114
+ setClearedErrors(serverErrors);
115
+ },
116
+ updateValidation(v) {
117
+ if (props.validationBehavior === "native") next = v;
118
+ else setCurrent(v);
119
+ }
120
+ };
121
+ }
122
+ function mergeValidation(...results) {
123
+ const errors = /* @__PURE__ */ new Set();
124
+ let isInvalid = false;
125
+ const validationDetails = { ...VALID_VALIDITY_STATE };
126
+ for (const v of results) {
127
+ for (const e of v.validationErrors) errors.add(e);
128
+ isInvalid ||= v.isInvalid;
129
+ for (const key of [
130
+ "badInput",
131
+ "customError",
132
+ "patternMismatch",
133
+ "rangeOverflow",
134
+ "rangeUnderflow",
135
+ "stepMismatch",
136
+ "tooLong",
137
+ "tooShort",
138
+ "typeMismatch",
139
+ "valid",
140
+ "valueMissing"
141
+ ]) validationDetails[key] ||= v.validationDetails[key];
142
+ }
143
+ validationDetails.valid = !isInvalid;
144
+ return {
145
+ isInvalid,
146
+ validationDetails,
147
+ validationErrors: [...errors]
148
+ };
149
+ }
150
+ export { DEFAULT_VALIDATION_RESULT, FormValidationContext, VALID_VALIDITY_STATE, createFormValidationState, mergeValidation, privateValidationStateProp };
151
+
152
+ //# sourceMappingURL=create-form-validation-state.js.map