@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,253 @@
1
+ /*
2
+ * Copyright 2024 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/layout/GridLayout.ts.
14
+ * Modified for Solid Aria: adapted imports, collection descriptors, and reactive state 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 { getNodeProps } from "../utils/get-node-props.js";
18
+ import { requireValue } from "../utils/require-value.js";
19
+ import { Layout } from "../virtualizer/layout.js";
20
+ import { LayoutInfo } from "../virtualizer/layout-info.js";
21
+ import { Rect } from "../virtualizer/rect.js";
22
+ import { Size } from "../virtualizer/size.js";
23
+ // src/layout/grid-layout.ts
24
+ const DEFAULT_OPTIONS = {
25
+ dropIndicatorThickness: 2,
26
+ loaderHeight: 48,
27
+ maxColumns: Infinity,
28
+ maxItemSize: new Size(Infinity, Infinity),
29
+ maxSpace: Infinity,
30
+ minItemSize: new Size(200, 200),
31
+ minSpace: new Size(18, 18),
32
+ preserveAspectRatio: false
33
+ };
34
+ /**
35
+ * GridLayout is a virtualizer Layout implementation
36
+ * that arranges its items in a grid.
37
+ * The items are sized between a minimum and maximum size
38
+ * depending on the width of the container.
39
+ */
40
+ var GridLayout = class extends Layout {
41
+ gap = DEFAULT_OPTIONS.minSpace;
42
+ dropIndicatorThickness = 2;
43
+ numColumns = 0;
44
+ direction = "ltr";
45
+ contentSize = new Size();
46
+ layoutInfos = /* @__PURE__ */ new Map();
47
+ margin = 0;
48
+ shouldInvalidateLayoutOptions(newOptions, oldOptions) {
49
+ return newOptions.maxColumns !== oldOptions.maxColumns || newOptions.dropIndicatorThickness !== oldOptions.dropIndicatorThickness || newOptions.preserveAspectRatio !== oldOptions.preserveAspectRatio || !(newOptions.minItemSize ?? DEFAULT_OPTIONS.minItemSize).equals(oldOptions.minItemSize ?? DEFAULT_OPTIONS.minItemSize) || !(newOptions.maxItemSize ?? DEFAULT_OPTIONS.maxItemSize).equals(oldOptions.maxItemSize ?? DEFAULT_OPTIONS.maxItemSize) || !(newOptions.minSpace ?? DEFAULT_OPTIONS.minSpace).equals(oldOptions.minSpace ?? DEFAULT_OPTIONS.minSpace) || newOptions.maxHorizontalSpace !== oldOptions.maxHorizontalSpace || newOptions.loaderHeight !== oldOptions.loaderHeight || newOptions.direction !== oldOptions.direction;
50
+ }
51
+ update(invalidationContext) {
52
+ const measureGrid = () => {
53
+ const { minItemSize = DEFAULT_OPTIONS.minItemSize, maxItemSize = DEFAULT_OPTIONS.maxItemSize, preserveAspectRatio = DEFAULT_OPTIONS.preserveAspectRatio, minSpace = DEFAULT_OPTIONS.minSpace, maxHorizontalSpace = DEFAULT_OPTIONS.maxSpace, maxColumns = DEFAULT_OPTIONS.maxColumns, dropIndicatorThickness = DEFAULT_OPTIONS.dropIndicatorThickness, direction = "ltr" } = invalidationContext.layoutOptions ?? {};
54
+ const loaderHeight = invalidationContext.layoutOptions?.loaderHeight ?? DEFAULT_OPTIONS.loaderHeight;
55
+ this.dropIndicatorThickness = dropIndicatorThickness;
56
+ this.direction = direction;
57
+ const virtualizerWidth = this.attachedVirtualizer.size.width;
58
+ const maxItemWidth = Math.min(maxItemSize.width, virtualizerWidth);
59
+ const maxItemHeight = Number.isFinite(maxItemSize.height) ? maxItemSize.height : Math.floor(minItemSize.height / minItemSize.width * maxItemWidth);
60
+ const columns = Math.floor(virtualizerWidth / (minItemSize.width + minSpace.width));
61
+ const numColumns = Math.max(1, Math.min(maxColumns, columns));
62
+ this.numColumns = numColumns;
63
+ const width = virtualizerWidth - minSpace.width * Math.max(0, numColumns);
64
+ let itemWidth = Math.floor(width / numColumns);
65
+ itemWidth = Math.max(minItemSize.width, Math.min(maxItemWidth, itemWidth));
66
+ const t = (itemWidth - minItemSize.width) / Math.max(1, maxItemWidth - minItemSize.width);
67
+ let itemHeight = minItemSize.height + Math.floor((maxItemHeight - minItemSize.height) * t);
68
+ itemHeight = Math.max(minItemSize.height, Math.min(maxItemHeight, itemHeight));
69
+ const horizontalSpacing = Math.min(Math.max(maxHorizontalSpace, minSpace.width), Math.floor((virtualizerWidth - numColumns * itemWidth) / (numColumns + 1)));
70
+ this.gap = new Size(horizontalSpacing, minSpace.height);
71
+ this.margin = Math.floor((virtualizerWidth - numColumns * itemWidth - horizontalSpacing * (numColumns + 1)) / 2);
72
+ return {
73
+ horizontalSpacing,
74
+ itemHeight,
75
+ itemWidth,
76
+ loaderHeight,
77
+ minSpace,
78
+ numColumns,
79
+ preserveAspectRatio,
80
+ virtualizerWidth
81
+ };
82
+ };
83
+ const { virtualizerWidth, numColumns, itemWidth, itemHeight, horizontalSpacing, minSpace, preserveAspectRatio, loaderHeight: initialLoaderHeight } = measureGrid();
84
+ let loaderHeight = initialLoaderHeight;
85
+ const { collection } = this.attachedVirtualizer;
86
+ let collectionSize = collection.size;
87
+ let lastKey = collection.getLastKey();
88
+ for (let i = 0; i < 2 && lastKey !== null && lastKey !== void 0; i += 1) {
89
+ if (collection.getItem(lastKey)?.type === "skeleton") {
90
+ collectionSize += 1;
91
+ break;
92
+ }
93
+ lastKey = collection.getKeyBefore(lastKey);
94
+ }
95
+ let rows = Math.ceil(collectionSize / numColumns);
96
+ const iterator = collection[Symbol.iterator]();
97
+ let y = rows > 0 ? minSpace.height : 0;
98
+ const newLayoutInfos = /* @__PURE__ */ new Map();
99
+ let skeleton = null;
100
+ let skeletonCount = 0;
101
+ const buildRow = () => {
102
+ let maxHeight = 0;
103
+ const rowLayoutInfos = [];
104
+ for (let col = 0; col < numColumns; col += 1) {
105
+ const next = iterator.next();
106
+ const node = skeleton ?? (next.done === true ? void 0 : next.value);
107
+ if (!node) break;
108
+ if (node.type === "loader") continue;
109
+ if (node.type === "skeleton") skeleton = node;
110
+ const key = skeleton ? `${skeleton.key}-${skeletonCount}` : node.key;
111
+ if (skeleton) skeletonCount += 1;
112
+ const oldLayoutInfo = this.layoutInfos.get(key);
113
+ let content = node;
114
+ if (skeleton) content = oldLayoutInfo && oldLayoutInfo.content?.key === key ? oldLayoutInfo.content : {
115
+ ...skeleton,
116
+ key
117
+ };
118
+ const x = horizontalSpacing + col * (itemWidth + horizontalSpacing) + this.margin;
119
+ let height = itemHeight;
120
+ let estimatedSize = !preserveAspectRatio;
121
+ if (oldLayoutInfo && estimatedSize) {
122
+ ({height} = oldLayoutInfo.rect);
123
+ estimatedSize = invalidationContext.layoutOptionsChanged === true || invalidationContext.sizeChanged === true || oldLayoutInfo.estimatedSize || oldLayoutInfo.content !== content;
124
+ }
125
+ const rect = new Rect(x, y, itemWidth, height);
126
+ const layoutInfo = new LayoutInfo(node.type, key, rect);
127
+ layoutInfo.estimatedSize = estimatedSize;
128
+ layoutInfo.allowOverflow = true;
129
+ layoutInfo.content = content;
130
+ newLayoutInfos.set(key, layoutInfo);
131
+ rowLayoutInfos.push(layoutInfo);
132
+ maxHeight = Math.max(maxHeight, layoutInfo.rect.height);
133
+ }
134
+ for (const layoutInfo of rowLayoutInfos) layoutInfo.rect.height = maxHeight;
135
+ return maxHeight;
136
+ };
137
+ for (let row = 0; row < rows; row += 1) {
138
+ const maxHeight = buildRow();
139
+ y += maxHeight + minSpace.height;
140
+ if (skeleton !== null && row === rows - 1 && y < this.attachedVirtualizer.size.height) rows += 1;
141
+ }
142
+ const boundaryKey = collection.getLastKey();
143
+ const lastNode = boundaryKey === null ? null : collection.getItem(boundaryKey);
144
+ if (lastNode?.type === "loader") {
145
+ if (skeletonCount > 0 || !getNodeProps(lastNode).isLoading) loaderHeight = 0;
146
+ const loaderWidth = virtualizerWidth - horizontalSpacing * 2;
147
+ const rect = new Rect(horizontalSpacing, y, loaderWidth, loaderHeight);
148
+ const layoutInfo = new LayoutInfo("loader", lastNode.key, rect);
149
+ newLayoutInfos.set(lastNode.key, layoutInfo);
150
+ y = layoutInfo.rect.maxY;
151
+ }
152
+ this.layoutInfos = newLayoutInfos;
153
+ this.contentSize = new Size(this.attachedVirtualizer.size.width, y);
154
+ }
155
+ getLayoutInfo(key) {
156
+ return this.layoutInfos.get(key) ?? null;
157
+ }
158
+ getContentSize() {
159
+ return this.contentSize;
160
+ }
161
+ getVisibleLayoutInfos(rect) {
162
+ const layoutInfos = [];
163
+ for (const layoutInfo of this.layoutInfos.values()) if (layoutInfo.rect.intersects(rect) || this.attachedVirtualizer.isPersistedKey(layoutInfo.key) || layoutInfo.type === "loader") layoutInfos.push(layoutInfo);
164
+ return layoutInfos;
165
+ }
166
+ updateItemSize(key, size) {
167
+ const layoutInfo = this.layoutInfos.get(key);
168
+ if (!layoutInfo) return false;
169
+ if (size.height !== layoutInfo.rect.height) {
170
+ const newLayoutInfo = layoutInfo.copy();
171
+ newLayoutInfo.rect.height = size.height;
172
+ newLayoutInfo.estimatedSize = false;
173
+ this.layoutInfos.set(key, newLayoutInfo);
174
+ return true;
175
+ }
176
+ return false;
177
+ }
178
+ getDropTargetKey(x, y) {
179
+ let key = null;
180
+ if (this.numColumns === 1) {
181
+ const searchRect = new Rect(x, Math.max(0, y - this.gap.height), 1, Math.max(1, this.gap.height * 2));
182
+ const candidates = this.getVisibleLayoutInfos(searchRect);
183
+ let minDistance = Infinity;
184
+ for (const candidate of candidates) {
185
+ if (!candidate.rect.intersects(searchRect)) continue;
186
+ const yDist = Math.abs(candidate.rect.y - y);
187
+ const maxYDist = Math.abs(candidate.rect.maxY - y);
188
+ const dist = Math.min(yDist, maxYDist);
189
+ if (dist < minDistance) {
190
+ minDistance = dist;
191
+ ({key} = candidate);
192
+ }
193
+ }
194
+ } else {
195
+ const searchRect = new Rect(Math.max(0, x - this.gap.width), y, this.gap.width * 2, 1);
196
+ const candidates = this.getVisibleLayoutInfos(searchRect);
197
+ let minDistance = Infinity;
198
+ for (const candidate of candidates) {
199
+ if (!candidate.rect.intersects(searchRect)) continue;
200
+ const xDist = Math.abs(candidate.rect.x - x);
201
+ const maxXDist = Math.abs(candidate.rect.maxX - x);
202
+ const dist = Math.min(xDist, maxXDist);
203
+ if (dist < minDistance) {
204
+ minDistance = dist;
205
+ ({key} = candidate);
206
+ }
207
+ }
208
+ }
209
+ return key;
210
+ }
211
+ getDropTargetFromPoint(initialX, initialY, isValidDropTarget) {
212
+ let x = initialX;
213
+ let y = initialY;
214
+ if (this.layoutInfos.size === 0) return { type: "root" };
215
+ x += this.attachedVirtualizer.visibleRect.x;
216
+ y += this.attachedVirtualizer.visibleRect.y;
217
+ if (this.direction === "rtl" && this.numColumns > 1) x = this.contentSize.width - x;
218
+ const key = this.getDropTargetKey(x, y);
219
+ const layoutInfo = key === null || key === void 0 ? null : this.getLayoutInfo(key);
220
+ if (!layoutInfo) return { type: "root" };
221
+ const target = {
222
+ dropPosition: "on",
223
+ key: layoutInfo.key,
224
+ type: "item"
225
+ };
226
+ const pos = this.numColumns === 1 ? y : x;
227
+ const layoutInfoPos = this.numColumns === 1 ? layoutInfo.rect.y : layoutInfo.rect.x;
228
+ const size = this.numColumns === 1 ? layoutInfo.rect.height : layoutInfo.rect.width;
229
+ if (isValidDropTarget(target)) {
230
+ if (pos < layoutInfoPos + 5) target.dropPosition = "before";
231
+ else if (pos > layoutInfoPos + size - 5) target.dropPosition = "after";
232
+ } else {
233
+ const mid = layoutInfoPos + size / 2;
234
+ if (pos <= mid && isValidDropTarget({
235
+ ...target,
236
+ dropPosition: "before"
237
+ })) target.dropPosition = "before";
238
+ else if (pos >= mid && isValidDropTarget({
239
+ ...target,
240
+ dropPosition: "after"
241
+ })) target.dropPosition = "after";
242
+ }
243
+ return target;
244
+ }
245
+ getDropTargetLayoutInfo(target) {
246
+ const layoutInfo = requireValue(this.getLayoutInfo(target.key), "Drop targets must have layout information.");
247
+ const rect = this.numColumns === 1 ? new Rect(layoutInfo.rect.x, target.dropPosition === "before" ? layoutInfo.rect.y - this.gap.height / 2 - this.dropIndicatorThickness / 2 : layoutInfo.rect.maxY + this.gap.height / 2 - this.dropIndicatorThickness / 2, layoutInfo.rect.width, this.dropIndicatorThickness) : new Rect(target.dropPosition === "before" ? layoutInfo.rect.x - this.gap.width / 2 - this.dropIndicatorThickness / 2 : layoutInfo.rect.maxX + this.gap.width / 2 - this.dropIndicatorThickness / 2, layoutInfo.rect.y, this.dropIndicatorThickness, layoutInfo.rect.height);
248
+ return new LayoutInfo("dropIndicator", `${target.key}:${target.dropPosition}`, rect);
249
+ }
250
+ };
251
+ export { GridLayout };
252
+
253
+ //# sourceMappingURL=grid-layout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid-layout.js","names":[],"sources":["../../src/layout/grid-layout.ts"],"sourcesContent":["/*\n * Copyright 2024 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/layout/GridLayout.ts.\n * Modified for Solid Aria: adapted imports, collection descriptors, and reactive state 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 DropTarget,\n DropTargetDelegate,\n ItemDropTarget,\n Key,\n Node,\n} from \"@solid2-aria/types-shared\";\n\nimport { getNodeProps } from \"../utils/get-node-props\";\nimport { requireValue } from \"../utils/require-value\";\nimport { Layout } from \"../virtualizer/layout\";\nimport { LayoutInfo } from \"../virtualizer/layout-info\";\nimport { Rect } from \"../virtualizer/rect\";\nimport { Size } from \"../virtualizer/size\";\nimport type { InvalidationContext } from \"../virtualizer/types\";\n\nexport interface GridLayoutOptions {\n /**\n * The minimum item size.\n *\n * @default 200 x 200\n */\n minItemSize?: Size;\n /**\n * The maximum item size.\n *\n * @default Infinity\n */\n maxItemSize?: Size;\n /**\n * Whether to preserve the aspect ratio of the `minItemSize`.\n * By default, grid rows may have variable heights. When `preserveAspectRatio`\n * is true, all rows will have equal heights.\n *\n * @default false\n */\n preserveAspectRatio?: boolean;\n /**\n * The minimum space required between items.\n *\n * @default 18 x 18\n */\n minSpace?: Size;\n /**\n * The maximum allowed horizontal space between items.\n *\n * @default Infinity\n */\n maxHorizontalSpace?: number;\n /**\n * The maximum number of columns.\n *\n * @default Infinity\n */\n maxColumns?: number;\n /**\n * The thickness of the drop indicator.\n *\n * @default 2\n */\n dropIndicatorThickness?: number;\n /**\n * The fixed height of a loader element in px. This loader is specifically for \"load more\"\n * elements rendered when loading more rows at the root level or inside nested row/sections.\n *\n * @default 48\n */\n loaderHeight?: number;\n /**\n * The layout direction. When `'rtl'`, drop target positions (`'before'`/`'after'`)\n * are computed correctly for right-to-left locales in multi-column grids.\n *\n * @default 'ltr'\n */\n direction?: \"ltr\" | \"rtl\";\n}\n\nconst DEFAULT_OPTIONS = {\n dropIndicatorThickness: 2,\n loaderHeight: 48,\n maxColumns: Infinity,\n maxItemSize: new Size(Infinity, Infinity),\n maxSpace: Infinity,\n minItemSize: new Size(200, 200),\n minSpace: new Size(18, 18),\n preserveAspectRatio: false,\n};\n\n/**\n * GridLayout is a virtualizer Layout implementation\n * that arranges its items in a grid.\n * The items are sized between a minimum and maximum size\n * depending on the width of the container.\n */\nexport class GridLayout<T, O extends GridLayoutOptions = GridLayoutOptions>\n extends Layout<Node<T>, O>\n implements DropTargetDelegate\n{\n protected gap: Size = DEFAULT_OPTIONS.minSpace;\n protected dropIndicatorThickness = 2;\n protected numColumns = 0;\n protected direction: \"ltr\" | \"rtl\" = \"ltr\";\n private contentSize: Size = new Size();\n private layoutInfos = new Map<Key, LayoutInfo<Node<T>>>();\n private margin = 0;\n override shouldInvalidateLayoutOptions(\n newOptions: O,\n oldOptions: O\n ): boolean {\n return (\n newOptions.maxColumns !== oldOptions.maxColumns ||\n newOptions.dropIndicatorThickness !== oldOptions.dropIndicatorThickness ||\n newOptions.preserveAspectRatio !== oldOptions.preserveAspectRatio ||\n !(newOptions.minItemSize ?? DEFAULT_OPTIONS.minItemSize).equals(\n oldOptions.minItemSize ?? DEFAULT_OPTIONS.minItemSize\n ) ||\n !(newOptions.maxItemSize ?? DEFAULT_OPTIONS.maxItemSize).equals(\n oldOptions.maxItemSize ?? DEFAULT_OPTIONS.maxItemSize\n ) ||\n !(newOptions.minSpace ?? DEFAULT_OPTIONS.minSpace).equals(\n oldOptions.minSpace ?? DEFAULT_OPTIONS.minSpace\n ) ||\n newOptions.maxHorizontalSpace !== oldOptions.maxHorizontalSpace ||\n newOptions.loaderHeight !== oldOptions.loaderHeight ||\n newOptions.direction !== oldOptions.direction\n );\n }\n override update(invalidationContext: InvalidationContext<O>): void {\n const measureGrid = () => {\n const {\n minItemSize = DEFAULT_OPTIONS.minItemSize,\n maxItemSize = DEFAULT_OPTIONS.maxItemSize,\n preserveAspectRatio = DEFAULT_OPTIONS.preserveAspectRatio,\n minSpace = DEFAULT_OPTIONS.minSpace,\n maxHorizontalSpace = DEFAULT_OPTIONS.maxSpace,\n maxColumns = DEFAULT_OPTIONS.maxColumns,\n dropIndicatorThickness = DEFAULT_OPTIONS.dropIndicatorThickness,\n direction = \"ltr\" as const,\n } = invalidationContext.layoutOptions ?? {};\n\n const loaderHeight =\n invalidationContext.layoutOptions?.loaderHeight ??\n DEFAULT_OPTIONS.loaderHeight;\n\n this.dropIndicatorThickness = dropIndicatorThickness;\n this.direction = direction;\n const virtualizerWidth = this.attachedVirtualizer.size.width;\n // The max item width is always the entire viewport.\n // If the max item height is infinity, scale in proportion to the max width.\n const maxItemWidth = Math.min(maxItemSize.width, virtualizerWidth);\n\n const maxItemHeight = Number.isFinite(maxItemSize.height)\n ? maxItemSize.height\n : Math.floor((minItemSize.height / minItemSize.width) * maxItemWidth);\n\n // Compute the number of rows and columns needed to display the content\n const columns = Math.floor(\n virtualizerWidth / (minItemSize.width + minSpace.width)\n );\n\n const numColumns = Math.max(1, Math.min(maxColumns, columns));\n this.numColumns = numColumns;\n // Compute the available width (minus the space between items)\n const width = virtualizerWidth - minSpace.width * Math.max(0, numColumns);\n // Compute the item width based on the space available\n let itemWidth = Math.floor(width / numColumns);\n itemWidth = Math.max(\n minItemSize.width,\n Math.min(maxItemWidth, itemWidth)\n );\n\n // Compute the item height, which is proportional to the item width\n const t =\n (itemWidth - minItemSize.width) /\n Math.max(1, maxItemWidth - minItemSize.width);\n\n let itemHeight =\n minItemSize.height +\n Math.floor((maxItemHeight - minItemSize.height) * t);\n\n itemHeight = Math.max(\n minItemSize.height,\n Math.min(maxItemHeight, itemHeight)\n );\n\n // Compute the horizontal spacing, content height and horizontal margin\n const horizontalSpacing = Math.min(\n Math.max(maxHorizontalSpace, minSpace.width),\n Math.floor(\n (virtualizerWidth - numColumns * itemWidth) / (numColumns + 1)\n )\n );\n\n this.gap = new Size(horizontalSpacing, minSpace.height);\n this.margin = Math.floor(\n (virtualizerWidth -\n numColumns * itemWidth -\n horizontalSpacing * (numColumns + 1)) /\n 2\n );\n\n return {\n horizontalSpacing,\n itemHeight,\n itemWidth,\n loaderHeight,\n minSpace,\n numColumns,\n preserveAspectRatio,\n virtualizerWidth,\n };\n };\n\n const {\n virtualizerWidth,\n numColumns,\n itemWidth,\n itemHeight,\n horizontalSpacing,\n minSpace,\n preserveAspectRatio,\n loaderHeight: initialLoaderHeight,\n } = measureGrid();\n\n let loaderHeight = initialLoaderHeight;\n // If there is a skeleton loader within the last 2 items in the collection, increment the collection size\n // so that an additional row is added for the skeletons.\n const { collection } = this.attachedVirtualizer;\n let collectionSize = collection.size;\n let lastKey = collection.getLastKey();\n\n for (\n let i = 0;\n i < 2 && lastKey !== null && lastKey !== undefined;\n i += 1\n ) {\n const item = collection.getItem(lastKey);\n\n if (item?.type === \"skeleton\") {\n collectionSize += 1;\n break;\n }\n\n lastKey = collection.getKeyBefore(lastKey);\n }\n\n let rows = Math.ceil(collectionSize / numColumns);\n const iterator = collection[Symbol.iterator]();\n let y = rows > 0 ? minSpace.height : 0;\n const newLayoutInfos = new Map<Key, LayoutInfo<Node<T>>>();\n let skeleton: Node<T> | null = null;\n let skeletonCount = 0;\n\n const buildRow = () => {\n let maxHeight = 0;\n const rowLayoutInfos: LayoutInfo[] = [];\n\n for (let col = 0; col < numColumns; col += 1) {\n // Repeat skeleton until the end of the current row.\n const next = iterator.next();\n\n const node: Node<T> | undefined =\n skeleton ?? (next.done === true ? undefined : next.value);\n\n if (!node) {\n break;\n }\n\n // We will add the loader after the skeletons so skip here\n if (node.type === \"loader\") {\n continue;\n }\n\n if (node.type === \"skeleton\") {\n skeleton = node;\n }\n\n const key = skeleton ? `${skeleton.key}-${skeletonCount}` : node.key;\n\n if (skeleton) {\n skeletonCount += 1;\n }\n\n const oldLayoutInfo = this.layoutInfos.get(key);\n let content = node;\n\n if (skeleton) {\n content =\n oldLayoutInfo && oldLayoutInfo.content?.key === key\n ? oldLayoutInfo.content\n : { ...skeleton, key };\n }\n\n const x =\n horizontalSpacing +\n col * (itemWidth + horizontalSpacing) +\n this.margin;\n\n let height = itemHeight;\n let estimatedSize = !preserveAspectRatio;\n\n if (oldLayoutInfo && estimatedSize) {\n ({ height } = oldLayoutInfo.rect);\n estimatedSize =\n invalidationContext.layoutOptionsChanged === true ||\n invalidationContext.sizeChanged === true ||\n oldLayoutInfo.estimatedSize ||\n oldLayoutInfo.content !== content;\n }\n\n const rect = new Rect(x, y, itemWidth, height);\n const layoutInfo = new LayoutInfo<Node<T>>(node.type, key, rect);\n layoutInfo.estimatedSize = estimatedSize;\n layoutInfo.allowOverflow = true;\n layoutInfo.content = content;\n newLayoutInfos.set(key, layoutInfo);\n rowLayoutInfos.push(layoutInfo);\n maxHeight = Math.max(maxHeight, layoutInfo.rect.height);\n }\n\n for (const layoutInfo of rowLayoutInfos) {\n layoutInfo.rect.height = maxHeight;\n }\n\n return maxHeight;\n };\n\n for (let row = 0; row < rows; row += 1) {\n const maxHeight = buildRow();\n y += maxHeight + minSpace.height;\n\n // Keep adding skeleton rows until we fill the viewport\n if (\n skeleton !== null &&\n row === rows - 1 &&\n y < this.attachedVirtualizer.size.height\n ) {\n rows += 1;\n }\n }\n\n // Always add the loader sentinel if present in the collection so we can make sure it is never virtualized out.\n const boundaryKey = collection.getLastKey();\n\n const lastNode =\n boundaryKey === null ? null : collection.getItem(boundaryKey);\n\n if (lastNode?.type === \"loader\") {\n if (skeletonCount > 0 || !getNodeProps(lastNode).isLoading) {\n loaderHeight = 0;\n }\n\n const loaderWidth = virtualizerWidth - horizontalSpacing * 2;\n // Note that if the user provides isLoading to their sentinel during a case where they only want to render the emptyState, this will reserve\n // room for the loader alongside rendering the emptyState\n const rect = new Rect(horizontalSpacing, y, loaderWidth, loaderHeight);\n const layoutInfo = new LayoutInfo<Node<T>>(\"loader\", lastNode.key, rect);\n newLayoutInfos.set(lastNode.key, layoutInfo);\n y = layoutInfo.rect.maxY;\n }\n\n this.layoutInfos = newLayoutInfos;\n this.contentSize = new Size(this.attachedVirtualizer.size.width, y);\n }\n getLayoutInfo(key: Key): LayoutInfo | null {\n return this.layoutInfos.get(key) ?? null;\n }\n getContentSize(): Size {\n return this.contentSize;\n }\n getVisibleLayoutInfos(rect: Rect): LayoutInfo[] {\n const layoutInfos: LayoutInfo[] = [];\n\n for (const layoutInfo of this.layoutInfos.values()) {\n if (\n layoutInfo.rect.intersects(rect) ||\n this.attachedVirtualizer.isPersistedKey(layoutInfo.key) ||\n layoutInfo.type === \"loader\"\n ) {\n layoutInfos.push(layoutInfo);\n }\n }\n\n return layoutInfos;\n }\n override updateItemSize(key: Key, size: Size): boolean {\n const layoutInfo = this.layoutInfos.get(key);\n\n if (!layoutInfo) {\n return false;\n }\n\n if (size.height !== layoutInfo.rect.height) {\n const newLayoutInfo = layoutInfo.copy();\n newLayoutInfo.rect.height = size.height;\n newLayoutInfo.estimatedSize = false;\n this.layoutInfos.set(key, newLayoutInfo);\n\n return true;\n }\n\n return false;\n }\n private getDropTargetKey(x: number, y: number): Key | null {\n let key: Key | null = null;\n\n if (this.numColumns === 1) {\n const searchRect = new Rect(\n x,\n Math.max(0, y - this.gap.height),\n 1,\n Math.max(1, this.gap.height * 2)\n );\n\n const candidates = this.getVisibleLayoutInfos(searchRect);\n let minDistance = Infinity;\n\n for (const candidate of candidates) {\n // Ignore items outside the search rect, e.g. persisted keys.\n if (!candidate.rect.intersects(searchRect)) {\n continue;\n }\n\n const yDist = Math.abs(candidate.rect.y - y);\n const maxYDist = Math.abs(candidate.rect.maxY - y);\n const dist = Math.min(yDist, maxYDist);\n\n if (dist < minDistance) {\n minDistance = dist;\n ({ key } = candidate);\n }\n }\n } else {\n const searchRect = new Rect(\n Math.max(0, x - this.gap.width),\n y,\n this.gap.width * 2,\n 1\n );\n\n const candidates = this.getVisibleLayoutInfos(searchRect);\n let minDistance = Infinity;\n\n for (const candidate of candidates) {\n // Ignore items outside the search rect, e.g. persisted keys.\n if (!candidate.rect.intersects(searchRect)) {\n continue;\n }\n\n const xDist = Math.abs(candidate.rect.x - x);\n const maxXDist = Math.abs(candidate.rect.maxX - x);\n const dist = Math.min(xDist, maxXDist);\n\n if (dist < minDistance) {\n minDistance = dist;\n ({ key } = candidate);\n }\n }\n }\n\n return key;\n }\n getDropTargetFromPoint(\n initialX: number,\n initialY: number,\n isValidDropTarget: (target: DropTarget) => boolean\n ): DropTarget {\n let x = initialX;\n\n let y = initialY;\n\n if (this.layoutInfos.size === 0) {\n return { type: \"root\" };\n }\n\n x += this.attachedVirtualizer.visibleRect.x;\n y += this.attachedVirtualizer.visibleRect.y;\n\n // In RTL mode the virtualizer positions items using CSS `right` with the\n // layout rect's x value as the right-offset, but pointer coordinates are\n // in visual (left-origin) space. Flip x so it matches the layout coords.\n if (this.direction === \"rtl\" && this.numColumns > 1) {\n x = this.contentSize.width - x;\n }\n\n // Find the closest item within on either side of the point using the gap width.\n const key = this.getDropTargetKey(x, y);\n\n const layoutInfo =\n key === null || key === undefined ? null : this.getLayoutInfo(key);\n\n if (!layoutInfo) {\n return { type: \"root\" };\n }\n\n const target: DropTarget = {\n dropPosition: \"on\",\n key: layoutInfo.key,\n type: \"item\",\n };\n\n const pos = this.numColumns === 1 ? y : x;\n\n const layoutInfoPos =\n this.numColumns === 1 ? layoutInfo.rect.y : layoutInfo.rect.x;\n\n const size =\n this.numColumns === 1 ? layoutInfo.rect.height : layoutInfo.rect.width;\n\n if (isValidDropTarget(target)) {\n // If dropping on the item is accepted, try the before/after positions\n // if within 5px of the start or end of the item.\n if (pos < layoutInfoPos + 5) {\n target.dropPosition = \"before\";\n } else if (pos > layoutInfoPos + size - 5) {\n target.dropPosition = \"after\";\n }\n } else {\n // If dropping on the item isn't accepted, try the target before or after depending on the position.\n const mid = layoutInfoPos + size / 2;\n\n if (\n pos <= mid &&\n isValidDropTarget({ ...target, dropPosition: \"before\" })\n ) {\n target.dropPosition = \"before\";\n } else if (\n pos >= mid &&\n isValidDropTarget({ ...target, dropPosition: \"after\" })\n ) {\n target.dropPosition = \"after\";\n }\n }\n\n return target;\n }\n override getDropTargetLayoutInfo(target: ItemDropTarget): LayoutInfo {\n const layoutInfo = requireValue(\n this.getLayoutInfo(target.key),\n \"Drop targets must have layout information.\"\n );\n\n const rect =\n this.numColumns === 1\n ? new Rect(\n layoutInfo.rect.x,\n target.dropPosition === \"before\"\n ? layoutInfo.rect.y -\n this.gap.height / 2 -\n this.dropIndicatorThickness / 2\n : layoutInfo.rect.maxY +\n this.gap.height / 2 -\n this.dropIndicatorThickness / 2,\n layoutInfo.rect.width,\n this.dropIndicatorThickness\n )\n : new Rect(\n target.dropPosition === \"before\"\n ? layoutInfo.rect.x -\n this.gap.width / 2 -\n this.dropIndicatorThickness / 2\n : layoutInfo.rect.maxX +\n this.gap.width / 2 -\n this.dropIndicatorThickness / 2,\n layoutInfo.rect.y,\n this.dropIndicatorThickness,\n layoutInfo.rect.height\n );\n\n return new LayoutInfo<Node<T>>(\n \"dropIndicator\",\n `${target.key}:${target.dropPosition}`,\n rect\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA8FA,MAAM,kBAAkB;CACtB,wBAAwB;CACxB,cAAc;CACd,YAAY;CACZ,aAAa,IAAI,KAAK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AK,GAChB,OAAO,iBAAiB,WACpB,WAAW,KAAK,IACd,KAAK,IAAI,SAAS,IAClB,KAAK,yBAAyB,IAChC,WAAW,KAAK,OACd,KAAK,IAAI,SAAS,IAClB,KAAK,yBAAyB,GACpC,WAAW,KAAK,OAChB,KAAK,sBACP,IACA,IAAI,KACF,OAAO,iBAAiB,WACpB,WAAW,KAAK,IACd,KAAK,IAAI,QAAQ,IACjB,KAAK,yBAAyB,IAChC,WAAW,KAAK,OACd,KAAK,IAAI,QAAQ,IACjB,KAAK,yBAAyB,GACpC,WAAW,KAAK,GAChB,KAAK,wBACL,WAAW,KAAK,MAClB;EAEN,OAAO,IAAI,WACT,iBACA,GAAG,OAAO,IAAI,GAAG,OAAO,gBACxB,IACF;CACF;AACF"}
@@ -0,0 +1,187 @@
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/layout/ListLayout.ts.
14
+ * Modified for Solid Aria: adapted imports, collection descriptors, and reactive state 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 { Size } from "../virtualizer/size.js";
18
+ import { Rect } from "../virtualizer/rect.js";
19
+ import { LayoutInfo } from "../virtualizer/layout-info.js";
20
+ import { InvalidationContext } from "../virtualizer/types.js";
21
+ import { Layout } from "../virtualizer/layout.js";
22
+ import { Collection, DropTarget, DropTargetDelegate, ItemDropTarget, Key, Node, Orientation } from "@solid2-aria/types-shared";
23
+ export interface ListLayoutOptions {
24
+ /**
25
+ * The primary orientation of the items. Usually this is the direction that the collection
26
+ * scrolls.
27
+ *
28
+ * @default 'vertical'
29
+ */
30
+ orientation?: Orientation;
31
+ /**
32
+ * The fixed size of a row in px with respect to the applied orientation.
33
+ *
34
+ * @default 48
35
+ */
36
+ rowSize?: number;
37
+ /**
38
+ * The estimated size of a row in px with respect to the applied orientation, when row sizes are
39
+ * variable.
40
+ */
41
+ estimatedRowSize?: number;
42
+ /**
43
+ * The fixed size of a section header in px with respect to the applied orientation.
44
+ *
45
+ * @default 48
46
+ */
47
+ headingSize?: number;
48
+ /**
49
+ * The estimated size of a section header in px with respect to the applied orientation, when
50
+ * heading sizes are variable.
51
+ */
52
+ estimatedHeadingSize?: number;
53
+ /**
54
+ * The fixed size of a loader element in px with respect to the applied orientation. This loader
55
+ * is specifically for "load more" elements rendered when loading more rows at the root level or
56
+ * inside nested row/sections.
57
+ *
58
+ * @default 48
59
+ */
60
+ loaderSize?: number;
61
+ /**
62
+ * The thickness of the drop indicator.
63
+ *
64
+ * @default 2
65
+ */
66
+ dropIndicatorThickness?: number;
67
+ /**
68
+ * The gap between items.
69
+ *
70
+ * @default 0
71
+ */
72
+ gap?: number;
73
+ /**
74
+ * The padding around the list.
75
+ *
76
+ * @default 0
77
+ */
78
+ padding?: number;
79
+ /**
80
+ * The fixed height of a row in px.
81
+ *
82
+ * @deprecated Use `rowSize` instead.
83
+ * @default 48
84
+ */
85
+ rowHeight?: number;
86
+ /**
87
+ * The estimated height of a row, when row heights are variable.
88
+ *
89
+ * @deprecated Use `estimatedRowSize` instead.
90
+ */
91
+ estimatedRowHeight?: number;
92
+ /**
93
+ * The fixed height of a section header in px.
94
+ *
95
+ * @deprecated Use `headingSize` instead.
96
+ * @default 48
97
+ */
98
+ headingHeight?: number;
99
+ /**
100
+ * The estimated height of a section header, when the height is variable.
101
+ *
102
+ * @deprecated Use `estimatedHeadingSize` instead.
103
+ */
104
+ estimatedHeadingHeight?: number;
105
+ /**
106
+ * The fixed height of a loader element in px. This loader is specifically for "load more"
107
+ * elements rendered when loading more rows at the root level or inside nested row/sections.
108
+ *
109
+ * @deprecated Use `loaderSize` instead.
110
+ * @default 48
111
+ */
112
+ loaderHeight?: number;
113
+ }
114
+ export interface LayoutNode {
115
+ node?: Node<unknown>;
116
+ layoutInfo: LayoutInfo;
117
+ children?: LayoutNode[];
118
+ validRect: Rect;
119
+ index?: number;
120
+ }
121
+ /**
122
+ * ListLayout is a virtualizer Layout implementation
123
+ * that arranges its items in a stack along its applied orientation.
124
+ * It supports both fixed and variable size items.
125
+ */
126
+ export declare class ListLayout<T, O extends ListLayoutOptions = ListLayoutOptions> extends Layout<Node<T>, O> implements DropTargetDelegate {
127
+ protected rowSize: number | null;
128
+ protected orientation: Orientation;
129
+ protected estimatedRowSize: number | null;
130
+ protected headingSize: number | null;
131
+ protected estimatedHeadingSize: number | null;
132
+ protected loaderSize: number | null;
133
+ protected dropIndicatorThickness: number;
134
+ protected gap: number;
135
+ protected padding: number;
136
+ protected layoutNodes: Map<Key, LayoutNode>;
137
+ protected contentSize: Size;
138
+ protected lastCollection: Collection<Node<T>> | null;
139
+ protected rootNodes: LayoutNode[];
140
+ private invalidateEverything;
141
+ /** The rectangle containing currently valid layout infos. */
142
+ protected validRect: Rect;
143
+ /** The rectangle of requested layout infos so far. */
144
+ protected requestedRect: Rect;
145
+ /**
146
+ * Creates a new ListLayout with options. See the list of properties below for a description
147
+ * of the options that can be provided.
148
+ */
149
+ constructor(initialOptions?: ListLayoutOptions);
150
+ protected get collection(): Collection<Node<T>>;
151
+ /** @deprecated Use `rowSize` instead. */
152
+ protected get rowHeight(): number | null;
153
+ /** @deprecated Use `estimatedRowSize` instead. */
154
+ protected get estimatedRowHeight(): number | null;
155
+ /** @deprecated Use `headingSize` instead. */
156
+ protected get headingHeight(): number | null;
157
+ /** @deprecated Use `estimatedHeadingSize` instead. */
158
+ protected get estimatedHeadingHeight(): number | null;
159
+ /** @deprecated Use `loaderSize` instead. */
160
+ protected get loaderHeight(): number | null;
161
+ getLayoutInfo(key: Key): LayoutInfo | null;
162
+ getVisibleLayoutInfos(initialRect: Rect): LayoutInfo[];
163
+ protected layoutIfNeeded(rect: Rect): void;
164
+ private ensureLayoutInfo;
165
+ protected isVisible(node: LayoutNode, rect: Rect): boolean;
166
+ protected shouldInvalidateEverything(invalidationContext: InvalidationContext<O>): boolean;
167
+ shouldInvalidateLayoutOptions(initialNewOptions: O, initialOldOptions: O): boolean;
168
+ update(invalidationContext: InvalidationContext<O>): void;
169
+ private updateOptions;
170
+ protected buildCollection(initialOffset?: number): LayoutNode[];
171
+ protected isValid(node: Node<T>, offset: number): boolean;
172
+ protected buildChild(node: Node<T>, x: number, y: number, parentKey: Key | null): LayoutNode;
173
+ protected buildNode(node: Node<T>, x: number, y: number): LayoutNode;
174
+ protected buildLoader(node: Node<T>, x: number, y: number): LayoutNode;
175
+ protected buildSection(node: Node<T>, x: number, y: number): LayoutNode;
176
+ protected buildSectionHeader(node: Node<T>, x: number, y: number): LayoutNode;
177
+ protected buildItem(node: Node<T>, x: number, y: number): LayoutNode;
178
+ updateItemSize(key: Key, size: Size): boolean;
179
+ private updateLayoutNode;
180
+ getContentSize(): Size;
181
+ private getNearestDropKey;
182
+ getDropTargetFromPoint(initialX: number, initialY: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget | null;
183
+ getDropTargetLayoutInfo(target: ItemDropTarget): LayoutInfo;
184
+ }
185
+ /** Normalizes legacy height options once at the layout boundary. Modern values take precedence. */
186
+ export declare function normalizeListLayoutOptions(options: ListLayoutOptions): ListLayoutOptions;
187
+ //# sourceMappingURL=list-layout.d.ts.map