@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,327 @@
1
+ /*
2
+ * Copyright 2026 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/tokenfield/TokenFieldValue.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 { requireValue } from "../utils/require-value.js";
18
+ // src/tokenfield/token-field-value.ts
19
+ /** Represents a text selection in a TokenField. */
20
+ var SelectedRange = class {
21
+ /** The anchor position. */
22
+ anchor;
23
+ /** The current (i.e. caret) position. */
24
+ current;
25
+ /**
26
+ * Creates a new selection range. If only a single position is provided, the selection is
27
+ * collapsed.
28
+ */
29
+ constructor(anchor, current = anchor) {
30
+ this.anchor = anchor;
31
+ this.current = current;
32
+ }
33
+ /** Whether the selection is collapsed to a single caret position. */
34
+ get isCollapsed() {
35
+ return this.anchor.index === this.current.index && this.anchor.offset === this.current.offset;
36
+ }
37
+ /** The side of the selection closest to the start of the value. */
38
+ get start() {
39
+ return compare(this.anchor, this.current) < 0 ? this.anchor : this.current;
40
+ }
41
+ /** The side of the selection closest to the end of the value. */
42
+ get end() {
43
+ return compare(this.anchor, this.current) < 0 ? this.current : this.anchor;
44
+ }
45
+ /** Returns whether this selection is equal to another. */
46
+ isEqual(other) {
47
+ if (this === other) return true;
48
+ return this.anchor.index === other.anchor.index && this.anchor.offset === other.anchor.offset && this.current.index === other.current.index && this.current.offset === other.current.offset;
49
+ }
50
+ };
51
+ function compare(a, b) {
52
+ if (a.index === b.index) return a.offset - b.offset;
53
+ return a.index - b.index;
54
+ }
55
+ var Direction = /* @__PURE__ */ function(Direction) {
56
+ Direction[Direction["Forward"] = 1] = "Forward";
57
+ Direction[Direction["Backward"] = -1] = "Backward";
58
+ return Direction;
59
+ }(Direction || {});
60
+ /**
61
+ * A list of segments containing editable text and non-editable tokens.
62
+ */
63
+ var TokenFieldValue = class TokenFieldValue {
64
+ static Direction = Direction;
65
+ static SelectedRange = SelectedRange;
66
+ /** The text and token segments in the list. */
67
+ segments;
68
+ /** The selected range. */
69
+ selectedRange;
70
+ previous = null;
71
+ next = null;
72
+ isCoalescing = true;
73
+ /** Create a new list with the given segments. */
74
+ constructor(tokens, options) {
75
+ this.segments = tokens;
76
+ this.selectedRange = options?.selectedRange ?? new SelectedRange({
77
+ index: 0,
78
+ offset: 0
79
+ });
80
+ }
81
+ createFieldValue(segments) {
82
+ const Constructor = this.constructor;
83
+ return new Constructor(segments);
84
+ }
85
+ get caretPosition() {
86
+ return this.selectedRange.current;
87
+ }
88
+ /** Create a new list with the caret position set to the given position. */
89
+ withSelectedRange(selectedRange) {
90
+ if (this.selectedRange.isEqual(selectedRange)) return this;
91
+ const result = this.createFieldValue(this.segments);
92
+ result.selectedRange = selectedRange;
93
+ result.previous = this.previous;
94
+ result.next = this.next;
95
+ result.isCoalescing = this.isCoalescing;
96
+ return result;
97
+ }
98
+ withCaretPosition(position) {
99
+ return this.withSelectedRange(new SelectedRange(position));
100
+ }
101
+ static splitSegment(segment, offset) {
102
+ if (!segment) {
103
+ const empty = TokenFieldValue.createTextSegment("");
104
+ return [offset > 0 ? empty : null, offset > 0 ? null : empty];
105
+ }
106
+ if (segment.type === "token") return [offset > 0 ? { ...segment } : null, offset > 0 ? null : { ...segment }];
107
+ return [offset > 0 ? {
108
+ text: segment.text.slice(0, offset),
109
+ type: "text"
110
+ } : null, offset < segment.text.length ? TokenFieldValue.createTextSegment(segment.text.slice(offset)) : null];
111
+ }
112
+ static createTextSegment(text) {
113
+ return {
114
+ text,
115
+ type: "text"
116
+ };
117
+ }
118
+ tokenize(text) {
119
+ return [TokenFieldValue.createTextSegment(text)];
120
+ }
121
+ clampPosition(position) {
122
+ if (this.segments.length === 0) return {
123
+ index: 0,
124
+ offset: 0
125
+ };
126
+ if (this.segments.length > 0 && position.index >= this.segments.length) return {
127
+ index: this.segments.length - 1,
128
+ offset: requireValue(this.segments.at(-1), "Expected this.segments.at(-1) to exist.").text.length
129
+ };
130
+ if (position.index < 0) return {
131
+ index: 0,
132
+ offset: 0
133
+ };
134
+ return position;
135
+ }
136
+ /** Replace the text between two positions with new text. */
137
+ replaceRange(start, end, text, coalesce = true) {
138
+ return this.replaceRangeWithSegments(start, end, text.length > 0 ? [TokenFieldValue.createTextSegment(text)] : [], coalesce);
139
+ }
140
+ /** Replace the text between two positions with new segments. */
141
+ replaceRangeWithSegments(initialStart, initialEnd, insert, coalesce = true) {
142
+ let start = initialStart;
143
+ let end = initialEnd;
144
+ start = this.clampPosition(start);
145
+ end = this.clampPosition(end);
146
+ const startSegment = this.segments[start.index];
147
+ const endSegment = this.segments[end.index];
148
+ const [startSplit] = TokenFieldValue.splitSegment(startSegment, start.offset);
149
+ const [, endSplit] = TokenFieldValue.splitSegment(endSegment, end.offset);
150
+ const newSegments = this.segments.slice(0, start.index);
151
+ if (startSplit) appendSegments(newSegments, [startSplit]);
152
+ if (insert.length) appendSegments(newSegments, insert, (text) => this.tokenize(text));
153
+ const lastSegment = newSegments.at(-1);
154
+ const lastIsText = lastSegment && lastSegment.type === "text";
155
+ const caret = {
156
+ index: lastIsText === true ? newSegments.length - 1 : newSegments.length,
157
+ offset: lastIsText === true ? lastSegment.text.length : 0
158
+ };
159
+ if (endSplit) appendSegments(newSegments, [endSplit]);
160
+ appendSegments(newSegments, this.segments.slice(end.index + 1));
161
+ const segments = this.createFieldValue(newSegments);
162
+ segments.selectedRange = new SelectedRange(caret);
163
+ segments.isCoalescing = coalesce;
164
+ if (this.isCoalescing && coalesce && this.previous) {
165
+ segments.previous = this.previous;
166
+ segments.previous.next = segments;
167
+ } else {
168
+ segments.previous = this;
169
+ this.selectedRange = new SelectedRange(start, end);
170
+ this.next = segments;
171
+ }
172
+ return segments;
173
+ }
174
+ /** Find the boundary before or after a position using an Intl.Segmenter. */
175
+ findBoundaryWithSegmenter(initialPosition, segmenter, direction) {
176
+ let position = initialPosition;
177
+ position = this.clampPosition(position);
178
+ for (let i = position.index; i >= 0 && i < this.segments.length; i += direction) {
179
+ const segment = requireValue(this.segments[i], "Token traversal must stay within its segments.");
180
+ switch (segment.type) {
181
+ case "token":
182
+ if (i !== position.index || (direction === -1 ? position.offset > 0 : position.offset === 0)) {
183
+ const index = i + direction;
184
+ return {
185
+ index: Math.max(index, 0),
186
+ offset: direction === -1 && index >= 0 ? requireValue(this.segments[index], "Expected this.segments[index] to exist.").text.length : 0
187
+ };
188
+ }
189
+ continue;
190
+ case "text": {
191
+ let offset = direction === -1 ? segment.text.length : 0;
192
+ if (i === position.index) ({offset} = position);
193
+ if (direction === -1) offset -= 1;
194
+ if (offset < 0 || offset >= segment.text.length) continue;
195
+ let part = segmenter.segment(segment.text).containing(offset);
196
+ while (part && part.isWordLike === false) {
197
+ offset += direction;
198
+ part = segmenter.segment(segment.text).containing(offset);
199
+ }
200
+ if (part) return {
201
+ index: i,
202
+ offset: direction === -1 ? part.index : part.index + part.segment.length
203
+ };
204
+ continue;
205
+ }
206
+ }
207
+ }
208
+ return null;
209
+ }
210
+ /** Find a line boundary before or after a position. */
211
+ findLineBoundary(position, direction) {
212
+ const res = this.findText(position, direction, "\n");
213
+ if (res) return res;
214
+ return direction === -1 ? {
215
+ index: 0,
216
+ offset: 0
217
+ } : {
218
+ index: Math.max(0, this.segments.length - 1),
219
+ offset: this.segments.at(-1)?.text.length ?? 0
220
+ };
221
+ }
222
+ /** Find a string or regular expression match before or after a position. */
223
+ findText(position, direction, search) {
224
+ if (this.segments.length === 0) return null;
225
+ for (let i = position.index; i >= 0 && i < this.segments.length; i += direction) {
226
+ const segment = requireValue(this.segments[i], "Token traversal must stay within its segments.");
227
+ if (segment.type !== "text") continue;
228
+ const offset = findInText(segment.text, search, direction, i === position.index ? position.offset : void 0);
229
+ if (offset >= 0) return {
230
+ index: i,
231
+ offset
232
+ };
233
+ }
234
+ return null;
235
+ }
236
+ /** Delete text at a position using a segmenter. */
237
+ delete(position, segmenter, direction, coalesce = true) {
238
+ const boundary = this.findBoundaryWithSegmenter(position, segmenter, direction);
239
+ if (boundary) return this.replaceRange(direction === -1 ? boundary : position, direction === -1 ? position : boundary, "", coalesce);
240
+ return this.withSelectedRange(new SelectedRange(position));
241
+ }
242
+ /** Delete text to the next or previous line break. */
243
+ deleteLine(position, direction, coalesce = true) {
244
+ if (this.segments.length === 0) return this;
245
+ const boundary = this.findLineBoundary(position, direction);
246
+ if (boundary) return this.replaceRange(direction === -1 ? boundary : position, direction === -1 ? position : boundary, "", coalesce);
247
+ return this.withSelectedRange(new SelectedRange(position));
248
+ }
249
+ /** Create a new list containing a subset of the segments. */
250
+ slice(initialStart, initialEnd) {
251
+ let start = initialStart;
252
+ let end = initialEnd;
253
+ start = this.clampPosition(start);
254
+ end = this.clampPosition(end);
255
+ if (start.index === end.index && start.offset === end.offset) return this.createFieldValue([]);
256
+ if (start.index === end.index) {
257
+ const segment = requireValue(this.segments[start.index], "A token slice must reference an existing segment.");
258
+ if (segment.type === "text") return this.createFieldValue([{
259
+ text: segment.text.slice(start.offset, end.offset),
260
+ type: "text"
261
+ }]);
262
+ return this.createFieldValue([segment]);
263
+ }
264
+ const startSegment = this.segments[start.index];
265
+ const endSegment = this.segments[end.index];
266
+ const [, startSplit] = TokenFieldValue.splitSegment(startSegment, start.offset);
267
+ const [endSplit] = TokenFieldValue.splitSegment(endSegment, end.offset);
268
+ const result = [];
269
+ if (startSplit) result.push(startSplit);
270
+ result.push(...this.segments.slice(start.index + 1, end.index));
271
+ if (endSplit) result.push(endSplit);
272
+ return this.createFieldValue(result);
273
+ }
274
+ /** Convert the list to a string. */
275
+ toString() {
276
+ return this.segments.map((seg) => seg.text).join("");
277
+ }
278
+ /** Returns the previous list in the undo history. */
279
+ undo() {
280
+ return this.previous ?? this;
281
+ }
282
+ /** Returns the next list in the redo history. */
283
+ redo() {
284
+ return this.next ?? this;
285
+ }
286
+ /** End coalescing undo/redo history. */
287
+ endCoalescing() {
288
+ this.isCoalescing = false;
289
+ }
290
+ };
291
+ function findInText(text, search, direction, fromOffset) {
292
+ if (typeof search === "string") {
293
+ if (direction === -1) return text.lastIndexOf(search, fromOffset === void 0 ? text.length - 1 : fromOffset - 1);
294
+ return text.indexOf(search, fromOffset ?? 0);
295
+ }
296
+ if (direction === 1) {
297
+ const start = fromOffset ?? 0;
298
+ const index = text.slice(start).search(search);
299
+ return index >= 0 ? start + index : -1;
300
+ }
301
+ const limit = fromOffset ?? text.length;
302
+ if (limit < 0) return -1;
303
+ const re = search.flags.includes("g") ? search : new RegExp(search.source, `${search.flags}g`);
304
+ return [...text.slice(0, limit).matchAll(re)].at(-1)?.index ?? -1;
305
+ }
306
+ function appendSegments(segments, insert, tokenize) {
307
+ for (const segment of insert) {
308
+ if (segment.type === "text" && segment.text.length === 0) continue;
309
+ const last = segments.at(-1);
310
+ if (last && last.type === "text" && segment.type === "text") {
311
+ if (tokenize) {
312
+ const tokenized = tokenize(last.text + segment.text);
313
+ segments.splice(-1, 1, ...tokenized);
314
+ } else segments[segments.length - 1] = {
315
+ text: last.text + segment.text,
316
+ type: "text"
317
+ };
318
+ } else if (tokenize && segment.type === "text") {
319
+ const tokenized = tokenize(segment.text);
320
+ segments.push(...tokenized);
321
+ } else segments.push(segment);
322
+ }
323
+ return segments;
324
+ }
325
+ export { SelectedRange, TokenFieldValue };
326
+
327
+ //# sourceMappingURL=token-field-value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-field-value.js","names":[],"sources":["../../src/tokenfield/token-field-value.ts"],"sourcesContent":["/*\n * Copyright 2026 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/tokenfield/TokenFieldValue.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 { requireValue } from \"../utils/require-value\";\n\nexport type TokenFieldSegment<T = unknown> = TextSegment | TokenSegment<T>;\n\nexport interface TextSegment {\n type: \"text\";\n text: string;\n}\n\nexport interface TokenSegment<T = unknown> {\n type: \"token\";\n text: string;\n /** An arbitrary value associated with the token. */\n value?: T;\n}\n\nexport interface Position {\n /** Index of the segment in the list. */\n index: number;\n /** Text offset within the segment in UTF-16 code units. */\n offset: number;\n}\n\n/** Represents a text selection in a TokenField. */\nexport class SelectedRange {\n /** The anchor position. */\n anchor: Position;\n /** The current (i.e. caret) position. */\n current: Position;\n /**\n * Creates a new selection range. If only a single position is provided, the selection is\n * collapsed.\n */\n constructor(anchor: Position, current: Position = anchor) {\n this.anchor = anchor;\n this.current = current;\n }\n /** Whether the selection is collapsed to a single caret position. */\n get isCollapsed() {\n return (\n this.anchor.index === this.current.index &&\n this.anchor.offset === this.current.offset\n );\n }\n /** The side of the selection closest to the start of the value. */\n get start() {\n return compare(this.anchor, this.current) < 0 ? this.anchor : this.current;\n }\n /** The side of the selection closest to the end of the value. */\n get end() {\n return compare(this.anchor, this.current) < 0 ? this.current : this.anchor;\n }\n /** Returns whether this selection is equal to another. */\n isEqual(other: SelectedRange) {\n if (this === other) {\n return true;\n }\n\n return (\n this.anchor.index === other.anchor.index &&\n this.anchor.offset === other.anchor.offset &&\n this.current.index === other.current.index &&\n this.current.offset === other.current.offset\n );\n }\n}\n\nfunction compare(a: Position, b: Position) {\n if (a.index === b.index) {\n return a.offset - b.offset;\n }\n\n return a.index - b.index;\n}\n\nenum Direction {\n Forward = 1,\n Backward = -1,\n}\n\nexport interface TokenFieldValueOptions {\n selectedRange?: SelectedRange | null;\n}\n\n/**\n * A list of segments containing editable text and non-editable tokens.\n */\nexport class TokenFieldValue<T = unknown> {\n static readonly Direction = Direction;\n static readonly SelectedRange = SelectedRange;\n /** The text and token segments in the list. */\n readonly segments: readonly TokenFieldSegment<T>[];\n /** The selected range. */\n selectedRange: SelectedRange;\n // Linked list representing the undo/redo history.\n private previous: this | null = null;\n private next: this | null = null;\n private isCoalescing = true;\n /** Create a new list with the given segments. */\n constructor(\n tokens: readonly TokenFieldSegment<T>[],\n options?: TokenFieldValueOptions\n ) {\n this.segments = tokens;\n this.selectedRange =\n options?.selectedRange ?? new SelectedRange({ index: 0, offset: 0 });\n }\n protected createFieldValue(segments: readonly TokenFieldSegment<T>[]): this {\n // SAFETY: TokenFieldValue subclasses inherit the segment constructor contract and immutable edits preserve the runtime class.\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n const Constructor = this.constructor as new (\n segments: readonly TokenFieldSegment<T>[],\n options?: TokenFieldValueOptions\n ) => this;\n\n return new Constructor(segments);\n }\n get caretPosition(): Position {\n return this.selectedRange.current;\n }\n /** Create a new list with the caret position set to the given position. */\n withSelectedRange(selectedRange: SelectedRange): this {\n if (this.selectedRange.isEqual(selectedRange)) {\n return this;\n }\n\n const result = this.createFieldValue(this.segments);\n result.selectedRange = selectedRange;\n result.previous = this.previous;\n result.next = this.next;\n result.isCoalescing = this.isCoalescing;\n\n return result;\n }\n withCaretPosition(position: Position): this {\n return this.withSelectedRange(new SelectedRange(position));\n }\n private static splitSegment<T>(\n segment: TokenFieldSegment<T> | undefined,\n offset: number\n ): [TokenFieldSegment<T> | null, TokenFieldSegment<T> | null] {\n if (!segment) {\n const empty = TokenFieldValue.createTextSegment(\"\");\n\n return [offset > 0 ? empty : null, offset > 0 ? null : empty];\n }\n\n if (segment.type === \"token\") {\n return [\n offset > 0 ? { ...segment } : null,\n offset > 0 ? null : { ...segment },\n ];\n }\n\n return [\n offset > 0 ? { text: segment.text.slice(0, offset), type: \"text\" } : null,\n offset < segment.text.length\n ? TokenFieldValue.createTextSegment(segment.text.slice(offset))\n : null,\n ];\n }\n private static createTextSegment(text: string): TextSegment {\n return { text, type: \"text\" };\n }\n protected tokenize(text: string): TokenFieldSegment<T>[] {\n return [TokenFieldValue.createTextSegment(text)];\n }\n private clampPosition(position: Position): Position {\n if (this.segments.length === 0) {\n return { index: 0, offset: 0 };\n }\n\n if (this.segments.length > 0 && position.index >= this.segments.length) {\n return {\n index: this.segments.length - 1,\n offset: requireValue(\n this.segments.at(-1),\n \"Expected this.segments.at(-1) to exist.\"\n ).text.length,\n };\n }\n\n if (position.index < 0) {\n return { index: 0, offset: 0 };\n }\n\n return position;\n }\n /** Replace the text between two positions with new text. */\n replaceRange(\n start: Position,\n end: Position,\n text: string,\n coalesce = true\n ): this {\n return this.replaceRangeWithSegments(\n start,\n end,\n text.length > 0 ? [TokenFieldValue.createTextSegment(text)] : [],\n coalesce\n );\n }\n /** Replace the text between two positions with new segments. */\n replaceRangeWithSegments(\n initialStart: Position,\n initialEnd: Position,\n insert: TokenFieldSegment<T>[],\n coalesce = true\n ): this {\n let start = initialStart;\n\n let end = initialEnd;\n\n start = this.clampPosition(start);\n end = this.clampPosition(end);\n const startSegment = this.segments[start.index];\n const endSegment = this.segments[end.index];\n\n const [startSplit] = TokenFieldValue.splitSegment(\n startSegment,\n start.offset\n );\n\n const [, endSplit] = TokenFieldValue.splitSegment(endSegment, end.offset);\n const newSegments = this.segments.slice(0, start.index);\n\n if (startSplit) {\n appendSegments(newSegments, [startSplit]);\n }\n\n if (insert.length) {\n appendSegments(newSegments, insert, (text) => this.tokenize(text));\n }\n\n const lastSegment = newSegments.at(-1);\n const lastIsText = lastSegment && lastSegment.type === \"text\";\n\n const caret = {\n index: lastIsText === true ? newSegments.length - 1 : newSegments.length,\n offset: lastIsText === true ? lastSegment.text.length : 0,\n };\n\n if (endSplit) {\n appendSegments(newSegments, [endSplit]);\n }\n\n appendSegments(newSegments, this.segments.slice(end.index + 1));\n const segments = this.createFieldValue(newSegments);\n segments.selectedRange = new SelectedRange(caret);\n segments.isCoalescing = coalesce;\n\n if (this.isCoalescing && coalesce && this.previous) {\n segments.previous = this.previous;\n segments.previous.next = segments;\n } else {\n segments.previous = this;\n this.selectedRange = new SelectedRange(start, end);\n this.next = segments;\n }\n\n return segments;\n }\n /** Find the boundary before or after a position using an Intl.Segmenter. */\n findBoundaryWithSegmenter(\n initialPosition: Position,\n segmenter: Intl.Segmenter,\n direction: Direction\n ): Position | null {\n let position = initialPosition;\n\n position = this.clampPosition(position);\n\n for (\n let i = position.index;\n i >= 0 && i < this.segments.length;\n i += direction\n ) {\n const segment = requireValue(\n this.segments[i],\n \"Token traversal must stay within its segments.\"\n );\n\n switch (segment.type) {\n case \"token\": {\n if (\n i !== position.index ||\n (direction === Direction.Backward\n ? position.offset > 0\n : position.offset === 0)\n ) {\n const index = i + direction;\n\n return {\n index: Math.max(index, 0),\n offset:\n direction === Direction.Backward && index >= 0\n ? requireValue(\n this.segments[index],\n \"Expected this.segments[index] to exist.\"\n ).text.length\n : 0,\n };\n }\n\n continue;\n }\n\n case \"text\": {\n let offset =\n direction === Direction.Backward ? segment.text.length : 0;\n\n if (i === position.index) {\n ({ offset } = position);\n }\n\n if (direction === Direction.Backward) {\n offset -= 1;\n }\n\n if (offset < 0 || offset >= segment.text.length) {\n continue;\n }\n\n let part = segmenter.segment(segment.text).containing(offset);\n\n while (part && part.isWordLike === false) {\n offset += direction;\n part = segmenter.segment(segment.text).containing(offset);\n }\n\n if (part) {\n return {\n index: i,\n offset:\n direction === Direction.Backward\n ? part.index\n : part.index + part.segment.length,\n };\n }\n\n continue;\n }\n\n default: {\n break;\n }\n }\n }\n\n return null;\n }\n /** Find a line boundary before or after a position. */\n findLineBoundary(position: Position, direction: Direction): Position | null {\n const res = this.findText(position, direction, \"\\n\");\n\n if (res) {\n return res;\n }\n\n return direction === Direction.Backward\n ? { index: 0, offset: 0 }\n : {\n index: Math.max(0, this.segments.length - 1),\n offset: this.segments.at(-1)?.text.length ?? 0,\n };\n }\n /** Find a string or regular expression match before or after a position. */\n findText(\n position: Position,\n direction: Direction,\n search: string | RegExp\n ): Position | null {\n if (this.segments.length === 0) {\n return null;\n }\n\n for (\n let i = position.index;\n i >= 0 && i < this.segments.length;\n i += direction\n ) {\n const segment = requireValue(\n this.segments[i],\n \"Token traversal must stay within its segments.\"\n );\n\n if (segment.type !== \"text\") {\n continue;\n }\n\n const offset = findInText(\n segment.text,\n search,\n direction,\n i === position.index ? position.offset : undefined\n );\n\n if (offset >= 0) {\n return {\n index: i,\n offset,\n };\n }\n }\n\n return null;\n }\n /** Delete text at a position using a segmenter. */\n delete(\n position: Position,\n segmenter: Intl.Segmenter,\n direction: Direction,\n coalesce = true\n ): this {\n const boundary = this.findBoundaryWithSegmenter(\n position,\n segmenter,\n direction\n );\n\n if (boundary) {\n return this.replaceRange(\n direction === Direction.Backward ? boundary : position,\n direction === Direction.Backward ? position : boundary,\n \"\",\n coalesce\n );\n }\n\n return this.withSelectedRange(new SelectedRange(position));\n }\n /** Delete text to the next or previous line break. */\n deleteLine(position: Position, direction: Direction, coalesce = true): this {\n if (this.segments.length === 0) {\n return this;\n }\n\n const boundary = this.findLineBoundary(position, direction);\n\n if (boundary) {\n return this.replaceRange(\n direction === Direction.Backward ? boundary : position,\n direction === Direction.Backward ? position : boundary,\n \"\",\n coalesce\n );\n }\n\n return this.withSelectedRange(new SelectedRange(position));\n }\n /** Create a new list containing a subset of the segments. */\n slice(initialStart: Position, initialEnd: Position): this {\n let start = initialStart;\n\n let end = initialEnd;\n\n start = this.clampPosition(start);\n end = this.clampPosition(end);\n\n if (start.index === end.index && start.offset === end.offset) {\n return this.createFieldValue([]);\n }\n\n if (start.index === end.index) {\n const segment = requireValue(\n this.segments[start.index],\n \"A token slice must reference an existing segment.\"\n );\n\n if (segment.type === \"text\") {\n return this.createFieldValue([\n {\n text: segment.text.slice(start.offset, end.offset),\n type: \"text\",\n },\n ]);\n }\n\n return this.createFieldValue([segment]);\n }\n\n const startSegment = this.segments[start.index];\n const endSegment = this.segments[end.index];\n\n const [, startSplit] = TokenFieldValue.splitSegment(\n startSegment,\n start.offset\n );\n\n const [endSplit] = TokenFieldValue.splitSegment(endSegment, end.offset);\n const result: TokenFieldSegment<T>[] = [];\n\n if (startSplit) {\n result.push(startSplit);\n }\n\n result.push(...this.segments.slice(start.index + 1, end.index));\n\n if (endSplit) {\n result.push(endSplit);\n }\n\n return this.createFieldValue(result);\n }\n /** Convert the list to a string. */\n toString(): string {\n return this.segments.map((seg) => seg.text).join(\"\");\n }\n /** Returns the previous list in the undo history. */\n undo(): this {\n return this.previous ?? this;\n }\n /** Returns the next list in the redo history. */\n redo(): this {\n return this.next ?? this;\n }\n /** End coalescing undo/redo history. */\n endCoalescing(): void {\n this.isCoalescing = false;\n }\n}\n\nfunction findInText(\n text: string,\n search: string | RegExp,\n direction: Direction,\n fromOffset?: number\n): number {\n if (typeof search === \"string\") {\n if (direction === Direction.Backward) {\n return text.lastIndexOf(\n search,\n fromOffset === undefined ? text.length - 1 : fromOffset - 1\n );\n }\n\n return text.indexOf(search, fromOffset ?? 0);\n }\n\n if (direction === Direction.Forward) {\n const start = fromOffset ?? 0;\n const index = text.slice(start).search(search);\n\n return index >= 0 ? start + index : -1;\n }\n\n const limit = fromOffset ?? text.length;\n\n if (limit < 0) {\n return -1;\n }\n\n const re = search.flags.includes(\"g\")\n ? search\n : new RegExp(search.source, `${search.flags}g`);\n\n const matches = [...text.slice(0, limit).matchAll(re)];\n\n return matches.at(-1)?.index ?? -1;\n}\n\nfunction appendSegments<T>(\n segments: TokenFieldSegment<T>[],\n insert: TokenFieldSegment<T>[],\n tokenize?: (text: string) => TokenFieldSegment<T>[]\n): TokenFieldSegment<T>[] {\n for (const segment of insert) {\n if (segment.type === \"text\" && segment.text.length === 0) {\n continue;\n }\n\n const last = segments.at(-1);\n\n if (last && last.type === \"text\" && segment.type === \"text\") {\n if (tokenize) {\n const tokenized = tokenize(last.text + segment.text);\n segments.splice(-1, 1, ...tokenized);\n } else {\n segments[segments.length - 1] = {\n text: last.text + segment.text,\n type: \"text\",\n };\n }\n } else if (tokenize && segment.type === \"text\") {\n const tokenized = tokenize(segment.text);\n segments.push(...tokenized);\n } else {\n segments.push(segment);\n }\n }\n\n return segments;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAyCA,IAAa,gBAAb,MAA2B;;CAEzB;;CAEA;;;;;CAKA,YAAY,QAAkB,UAAoB,QAAQ;EACxD,KAAK,SAAS;EACd,KAAK,UAAU;CACjB;;CAEA,IAAI,cAAc;EAChB,OACE,KAAK,OAAO,UAAU,KAAK,QAAQ,SACnC,KAAK,OAAO,WAAW,KAAK,QAAQ;CAExC;;CAEA,IAAI,QAAQ;EACV,OAAO,QAAQ,KAAK,QAAQ,KAAK,OAAO,IAAI,IAAI,KAAK,SAAS,KAAK;CACrE;;CAEA,IAAI,MAAM;EACR,OAAO,QAAQ,KAAK,QAAQ,KAAK,OAAO,IAAI,IAAI,KAAK,UAAU,KAAK;CACtE;;CAEA,QAAQ,OAAsB;EAC5B,IAAI,SAAS,OACX,OAAO;EAGT,OACE,KAAK,OAAO,UAAU,MAAM,OAAO,SACnC,KAAK,OAAO,WAAW,MAAM,OAAO,UACpC,KAAK,QAAQ,UAAU,MAAM,QAAQ,SACrC,KAAK,QAAQ,WAAW,MAAM,QAAQ;CAE1C;AACF;AAEA,SAAS,QAAQ,GAAa,GAAa;CACzC,IAAI,EAAE,UAAU,EAAE,OAChB,OAAO,EAAE,SAAS,EAAE;CAGtB,OAAO,EAAE,QAAQ,EAAE;AACrB;AAEA,IAAK,YAAL,yBAAA,WAAA;CACE,UAAA,UAAA,aAAA,KAAA;CACA,UAAA,UAAA,cAAA,MAAA;;AACF,EAHK,aAAA,CAAA,CAGL;;;;AASA,IAAa,kBAAb,MAAa,gBAA6B;CACxC,OAAgB,YAAY;CAC5B,OAAgB,gBAAgB;;CAEhC;;CAEA;CAEA,WAAgC;CAChC,OAA4B;CAC5B,eAAuB;;CAEvB,YACE,QACA,SACA;EACA,KAAK,WAAW;EAChB,KAAK,gBACH,SAAS,iBAAiB,IAAI,cAAc;GAAE,OA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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/tooltip/useTooltipTriggerState.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 { OverlayTriggerProps } from "../overlays/create-overlay-trigger-state.js";
18
+ export interface TooltipTriggerProps extends OverlayTriggerProps {
19
+ /**
20
+ * Whether the tooltip should be disabled, independent from the trigger.
21
+ */
22
+ isDisabled?: boolean;
23
+ /**
24
+ * The delay time for the tooltip to show up. [See
25
+ * guidelines](https://spectrum.adobe.com/web/rsp/components/tooltip#behaviors).
26
+ *
27
+ * @default 1500
28
+ */
29
+ delay?: number;
30
+ /**
31
+ * The delay time for the tooltip to close. [See
32
+ * guidelines](https://spectrum.adobe.com/web/rsp/components/tooltip#behaviors).
33
+ *
34
+ * @default 500
35
+ */
36
+ closeDelay?: number;
37
+ /**
38
+ * By default, opens for both focus and hover. Can be made to open only for focus.
39
+ *
40
+ * @default 'hover'
41
+ */
42
+ trigger?: "hover" | "focus";
43
+ /**
44
+ * Whether the tooltip should close when the trigger is pressed.
45
+ *
46
+ * @default true
47
+ */
48
+ shouldCloseOnPress?: boolean;
49
+ }
50
+ export interface TooltipTriggerState {
51
+ /** Whether the tooltip is currently showing. */
52
+ isOpen: boolean;
53
+ /**
54
+ * Whether the tooltip is being shown or hidden without an animation. This is true while the
55
+ * global warmup timer is active, i.e. when quickly moving between tooltips.
56
+ */
57
+ shouldSkipAnimation: boolean;
58
+ /**
59
+ * Shows the tooltip. By default, the tooltip becomes visible after a delay
60
+ * depending on a global warmup timer. The `immediate` option shows the
61
+ * tooltip immediately instead.
62
+ */
63
+ open: (immediate?: boolean) => void;
64
+ /** Hides the tooltip. */
65
+ close: (immediate?: boolean) => void;
66
+ }
67
+ /**
68
+ * Manages state for a tooltip trigger. Tracks whether the tooltip is open, and provides
69
+ * methods to toggle this state. Ensures only one tooltip is open at a time and controls
70
+ * the delay for showing a tooltip.
71
+ */
72
+ export declare function createTooltipTriggerState(props?: TooltipTriggerProps): TooltipTriggerState;
73
+ //# sourceMappingURL=create-tooltip-trigger-state.d.ts.map
@@ -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/tooltip/useTooltipTriggerState.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 { createOverlayTriggerState } from "../overlays/create-overlay-trigger-state.js";
18
+ import { createSignal, onCleanup } from "solid-js";
19
+ // src/tooltip/create-tooltip-trigger-state.ts
20
+ const TOOLTIP_DELAY = 1500;
21
+ const TOOLTIP_COOLDOWN = 500;
22
+ const tooltips = /* @__PURE__ */ new Map();
23
+ let tooltipId = 0;
24
+ let globalWarmedUp = false;
25
+ let globalWarmUpTimeout = null;
26
+ let globalCooldownTimeout = null;
27
+ /**
28
+ * Manages state for a tooltip trigger. Tracks whether the tooltip is open, and provides
29
+ * methods to toggle this state. Ensures only one tooltip is open at a time and controls
30
+ * the delay for showing a tooltip.
31
+ */
32
+ function createTooltipTriggerState(props = {}) {
33
+ const overlay = createOverlayTriggerState(props);
34
+ const open = () => {
35
+ if (!(props.isDisabled === true)) overlay.open();
36
+ };
37
+ const close = () => {
38
+ overlay.close();
39
+ };
40
+ const [shouldSkipAnimation, setIsInstant] = createSignal(false, { ownedWrite: true });
41
+ const id = `${tooltipId += 1}`;
42
+ let closeTimeout = null;
43
+ const ensureTooltipEntry = () => {
44
+ tooltips.set(id, hideTooltip);
45
+ };
46
+ const closeOpenTooltips = () => {
47
+ for (const [hideTooltipId, hide] of tooltips) if (hideTooltipId !== id) {
48
+ hide(true, true);
49
+ tooltips.delete(hideTooltipId);
50
+ }
51
+ };
52
+ const showTooltip = (instant) => {
53
+ if (closeTimeout) clearTimeout(closeTimeout);
54
+ closeTimeout = null;
55
+ closeOpenTooltips();
56
+ ensureTooltipEntry();
57
+ setIsInstant(instant === true);
58
+ globalWarmedUp = true;
59
+ open();
60
+ if (globalWarmUpTimeout) {
61
+ clearTimeout(globalWarmUpTimeout);
62
+ globalWarmUpTimeout = null;
63
+ }
64
+ if (globalCooldownTimeout) {
65
+ clearTimeout(globalCooldownTimeout);
66
+ globalCooldownTimeout = null;
67
+ }
68
+ };
69
+ function hideTooltip(immediate, instant) {
70
+ setIsInstant(instant === true);
71
+ if (immediate === true || (props.closeDelay ?? TOOLTIP_COOLDOWN) <= 0) {
72
+ if (closeTimeout) clearTimeout(closeTimeout);
73
+ closeTimeout = null;
74
+ close();
75
+ } else closeTimeout ??= setTimeout(() => {
76
+ closeTimeout = null;
77
+ close();
78
+ }, props.closeDelay ?? TOOLTIP_COOLDOWN);
79
+ if (globalWarmUpTimeout) {
80
+ clearTimeout(globalWarmUpTimeout);
81
+ globalWarmUpTimeout = null;
82
+ }
83
+ if (globalWarmedUp) {
84
+ if (globalCooldownTimeout) clearTimeout(globalCooldownTimeout);
85
+ globalCooldownTimeout = setTimeout(() => {
86
+ tooltips.delete(id);
87
+ globalCooldownTimeout = null;
88
+ globalWarmedUp = false;
89
+ }, Math.max(TOOLTIP_COOLDOWN, props.closeDelay ?? TOOLTIP_COOLDOWN));
90
+ }
91
+ }
92
+ const warmupTooltip = () => {
93
+ closeOpenTooltips();
94
+ ensureTooltipEntry();
95
+ if (!overlay.isOpen && !globalWarmedUp) {
96
+ if (globalWarmUpTimeout) clearTimeout(globalWarmUpTimeout);
97
+ globalWarmUpTimeout = setTimeout(() => {
98
+ globalWarmUpTimeout = null;
99
+ globalWarmedUp = true;
100
+ showTooltip(false);
101
+ }, props.delay ?? TOOLTIP_DELAY);
102
+ } else if (!overlay.isOpen) showTooltip(true);
103
+ };
104
+ onCleanup(() => {
105
+ if (closeTimeout) clearTimeout(closeTimeout);
106
+ if (tooltips.has(id)) {
107
+ tooltips.delete(id);
108
+ if (globalWarmUpTimeout) {
109
+ clearTimeout(globalWarmUpTimeout);
110
+ globalWarmUpTimeout = null;
111
+ }
112
+ }
113
+ if (tooltips.size === 0) {
114
+ if (globalCooldownTimeout) clearTimeout(globalCooldownTimeout);
115
+ globalCooldownTimeout = null;
116
+ globalWarmedUp = false;
117
+ }
118
+ });
119
+ return {
120
+ close: hideTooltip,
121
+ get isOpen() {
122
+ return overlay.isOpen;
123
+ },
124
+ open: (immediate) => {
125
+ if (props.isDisabled === true) return;
126
+ if (!(immediate === true) && (props.delay ?? TOOLTIP_DELAY) > 0 && !closeTimeout) warmupTooltip();
127
+ else showTooltip(globalWarmedUp);
128
+ },
129
+ get shouldSkipAnimation() {
130
+ return shouldSkipAnimation();
131
+ }
132
+ };
133
+ }
134
+ export { createTooltipTriggerState };
135
+
136
+ //# sourceMappingURL=create-tooltip-trigger-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-tooltip-trigger-state.js","names":[],"sources":["../../src/tooltip/create-tooltip-trigger-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/tooltip/useTooltipTriggerState.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 { createSignal, onCleanup } from \"solid-js\";\n\nimport { createOverlayTriggerState } from \"../overlays/create-overlay-trigger-state\";\nimport type { OverlayTriggerProps } from \"../overlays/create-overlay-trigger-state\";\n\nexport interface TooltipTriggerProps extends OverlayTriggerProps {\n /**\n * Whether the tooltip should be disabled, independent from the trigger.\n */\n isDisabled?: boolean;\n /**\n * The delay time for the tooltip to show up. [See\n * guidelines](https://spectrum.adobe.com/web/rsp/components/tooltip#behaviors).\n *\n * @default 1500\n */\n delay?: number;\n /**\n * The delay time for the tooltip to close. [See\n * guidelines](https://spectrum.adobe.com/web/rsp/components/tooltip#behaviors).\n *\n * @default 500\n */\n closeDelay?: number;\n /**\n * By default, opens for both focus and hover. Can be made to open only for focus.\n *\n * @default 'hover'\n */\n trigger?: \"hover\" | \"focus\";\n /**\n * Whether the tooltip should close when the trigger is pressed.\n *\n * @default true\n */\n shouldCloseOnPress?: boolean;\n}\n\n// this seems to be a 1.5 second delay, check with design\nconst TOOLTIP_DELAY = 1500;\nconst TOOLTIP_COOLDOWN = 500;\n\nexport interface TooltipTriggerState {\n /** Whether the tooltip is currently showing. */\n isOpen: boolean;\n /**\n * Whether the tooltip is being shown or hidden without an animation. This is true while the\n * global warmup timer is active, i.e. when quickly moving between tooltips.\n */\n shouldSkipAnimation: boolean;\n /**\n * Shows the tooltip. By default, the tooltip becomes visible after a delay\n * depending on a global warmup timer. The `immediate` option shows the\n * tooltip immediately instead.\n */\n open: (immediate?: boolean) => void;\n /** Hides the tooltip. */\n close: (immediate?: boolean) => void;\n}\n\nconst tooltips = new Map<\n string,\n (immediate?: boolean, instant?: boolean) => void\n>();\n\nlet tooltipId = 0;\nlet globalWarmedUp = false;\nlet globalWarmUpTimeout: ReturnType<typeof setTimeout> | null = null;\nlet globalCooldownTimeout: ReturnType<typeof setTimeout> | null = null;\n\n/**\n * Manages state for a tooltip trigger. Tracks whether the tooltip is open, and provides\n * methods to toggle this state. Ensures only one tooltip is open at a time and controls\n * the delay for showing a tooltip.\n */\nexport function createTooltipTriggerState(\n props: TooltipTriggerProps = {}\n): TooltipTriggerState {\n const overlay = createOverlayTriggerState(props);\n\n const open = () => {\n if (!(props.isDisabled === true)) {\n overlay.open();\n }\n };\n\n const close = () => {\n overlay.close();\n };\n\n // Whether the current open/close transition should skip its animation. Set when swapping\n // between tooltips during the global warmup period.\n const [shouldSkipAnimation, setIsInstant] = createSignal(false, {\n ownedWrite: true,\n });\n\n const id = `${(tooltipId += 1)}`;\n\n let closeTimeout: ReturnType<typeof setTimeout> | null = null;\n\n const ensureTooltipEntry = () => {\n tooltips.set(id, hideTooltip);\n };\n\n const closeOpenTooltips = () => {\n for (const [hideTooltipId, hide] of tooltips) {\n if (hideTooltipId !== id) {\n // Close other open tooltips instantly (no exit animation), since they are being\n // replaced by this one during the warmup period.\n hide(true, true);\n tooltips.delete(hideTooltipId);\n }\n }\n };\n\n const showTooltip = (instant?: boolean) => {\n if (closeTimeout) {\n clearTimeout(closeTimeout);\n }\n\n closeTimeout = null;\n closeOpenTooltips();\n ensureTooltipEntry();\n setIsInstant(instant === true);\n globalWarmedUp = true;\n open();\n\n if (globalWarmUpTimeout) {\n clearTimeout(globalWarmUpTimeout);\n globalWarmUpTimeout = null;\n }\n\n if (globalCooldownTimeout) {\n clearTimeout(globalCooldownTimeout);\n globalCooldownTimeout = null;\n }\n };\n\n function hideTooltip(immediate?: boolean, instant?: boolean) {\n setIsInstant(instant === true);\n\n if (immediate === true || (props.closeDelay ?? TOOLTIP_COOLDOWN) <= 0) {\n if (closeTimeout) {\n clearTimeout(closeTimeout);\n }\n\n closeTimeout = null;\n close();\n } else {\n closeTimeout ??= setTimeout(() => {\n closeTimeout = null;\n close();\n }, props.closeDelay ?? TOOLTIP_COOLDOWN);\n }\n\n if (globalWarmUpTimeout) {\n clearTimeout(globalWarmUpTimeout);\n globalWarmUpTimeout = null;\n }\n\n if (globalWarmedUp) {\n if (globalCooldownTimeout) {\n clearTimeout(globalCooldownTimeout);\n }\n\n globalCooldownTimeout = setTimeout(\n () => {\n tooltips.delete(id);\n globalCooldownTimeout = null;\n globalWarmedUp = false;\n },\n Math.max(TOOLTIP_COOLDOWN, props.closeDelay ?? TOOLTIP_COOLDOWN)\n );\n }\n }\n\n const warmupTooltip = () => {\n closeOpenTooltips();\n ensureTooltipEntry();\n\n if (!overlay.isOpen && !globalWarmedUp) {\n if (globalWarmUpTimeout) {\n clearTimeout(globalWarmUpTimeout);\n }\n\n globalWarmUpTimeout = setTimeout(() => {\n globalWarmUpTimeout = null;\n globalWarmedUp = true;\n // First tooltip in a sequence: animate in.\n showTooltip(false);\n }, props.delay ?? TOOLTIP_DELAY);\n } else if (!overlay.isOpen) {\n // Already warmed up: appear instantly without an animation.\n showTooltip(true);\n }\n };\n\n onCleanup(() => {\n if (closeTimeout) {\n clearTimeout(closeTimeout);\n }\n\n if (tooltips.has(id)) {\n tooltips.delete(id);\n\n if (globalWarmUpTimeout) {\n clearTimeout(globalWarmUpTimeout);\n globalWarmUpTimeout = null;\n }\n }\n\n if (tooltips.size === 0) {\n if (globalCooldownTimeout) {\n clearTimeout(globalCooldownTimeout);\n }\n\n globalCooldownTimeout = null;\n globalWarmedUp = false;\n }\n });\n\n return {\n close: hideTooltip,\n get isOpen() {\n return overlay.isOpen;\n },\n open: (immediate) => {\n if (props.isDisabled === true) {\n return;\n }\n\n if (\n !(immediate === true) &&\n (props.delay ?? TOOLTIP_DELAY) > 0 &&\n !closeTimeout\n ) {\n warmupTooltip();\n } else {\n // Immediate opens (e.g. focus, or (props.delay ?? TOOLTIP_DELAY) of 0) appear instantly without an animation\n // only if another tooltip is already warmed up.\n showTooltip(globalWarmedUp);\n }\n },\n get shouldSkipAnimation() {\n return shouldSkipAnimation();\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAwDA,MAAM,gBAAgB;AACtB,MAAM,mBAAmB;AAoBzB,MAAM,2BAAW,IAAI,IAGnB;AAEF,IAAI,YAAY;AAChB,IAAI,iBAAiB;AACrB,IAAI,sBAA4D;AAChE,IAAI,wBAA8D;;;;;;AAOlE,SAAgB,0BACd,QAA6B,CAAC,GACT;CACrB,MAAM,UAAU,0BAA0B,KAAK;CAE/C,MAAM,aAAa;EACjB,IAAI,EAAE,MAAM,eAAe,OACzB,QAAQ,KAAK;CAEjB;CAEA,MAAM,cAAc;EAClB,QAAQ,MAAM;CAChB;CAIA,MAAM,CAAC,qBAAqB,gBAAgB,aAAa,OAAO,EAC9D,YAAY,KACd,CAAC;CAED,MAAM,KAAK,GAAI,aAAa;CAE5B,IAAI,eAAqD;CAEzD,MAAM,2BAA2B;EAC/B,SAAS,IAAI,IAAI,WAAW;CAC9B;CAEA,MAAM,0BAA0B;EAC9B,KAAK,MAAM,CAAC,eAAe,SAAS,UAClC,IAAI,kBAAkB,IAAI;GAGxB,KAAK,MAAM,IAAI;GACf,SAAS,OAAO,aAAa;EAC/B;CAEJ;CAEA,MAAM,eAAe,YAAsB;EACzC,IAAI,cACF,aAAa,YAAY;EAG3B,eAAe;EACf,kBAAkB;EAClB,mBAAmB;EACnB,aAAa,YAAY,IAAI;EAC7B,iBAAiB;EACjB,KAAK;EAEL,IAAI,qBAAqB;GACvB,aAAa,mBAAmB;GAChC,sBAAsB;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I,MAAM,eAAe,MACvB;GAGF,IACE,EAAE,cAAc,UACf,MAAM,SAAS,iBAAiB,KACjC,CAAC,cAED,cAAc;QAId,YAAY,cAAc;EAE9B;EACA,IAAI,sBAAsB;GACxB,OAAO,oBAAoB;EAC7B;CACF;AACF"}
@@ -0,0 +1,42 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+ /*
13
+ * Derived from Adobe React Spectrum: packages/react-stately/src/tree/useTreeState.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 { SelectionManager } from "../selection/selection-manager.js";
18
+ import { Collection, CollectionStateBase, DisabledBehavior, Expandable, Key, MultipleSelection, Node } from "@solid2-aria/types-shared";
19
+ export interface TreeProps<T> extends CollectionStateBase<T>, Expandable, MultipleSelection {
20
+ /** Whether `disabledKeys` applies to all interactions, or only selection. */
21
+ disabledBehavior?: DisabledBehavior;
22
+ }
23
+ export interface TreeState<T> {
24
+ /** A collection of items in the tree. */
25
+ readonly collection: Collection<Node<T>>;
26
+ /** A set of keys for items that are disabled. */
27
+ readonly disabledKeys: Set<Key>;
28
+ /** A set of keys for items that are expanded. */
29
+ readonly expandedKeys: Set<Key>;
30
+ /** Toggles the expanded state for an item by its key. */
31
+ toggleKey: (key: Key) => void;
32
+ /** Replaces the set of expanded keys. */
33
+ setExpandedKeys: (keys: Set<Key>) => void;
34
+ /** A selection manager to read and update multiple selection state. */
35
+ readonly selectionManager: SelectionManager;
36
+ }
37
+ /**
38
+ * Provides state management for tree-like components. Handles building a collection
39
+ * of items from props, item expanded state, and manages multiple selection state.
40
+ */
41
+ export declare function createTreeState<T extends object>(props: TreeProps<T>): TreeState<T>;
42
+ //# sourceMappingURL=create-tree-state.d.ts.map