@esportsplus/ui 0.63.0 → 0.64.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 (538) hide show
  1. package/.audit/audit.json +2 -2
  2. package/.audit/rules-audit.md +2 -2
  3. package/README.md +15 -18
  4. package/RULES.md +80 -9
  5. package/bin/agent-cli +300 -0
  6. package/build/components/accordion/index.d.ts +4 -0
  7. package/build/components/accordion/index.js +13 -10
  8. package/build/components/breadcrumb/index.d.ts +1 -0
  9. package/build/components/breadcrumb/index.js +43 -37
  10. package/build/components/breadcrumb/scss/index.scss +1 -1
  11. package/build/components/button/kbd.d.ts +1 -1
  12. package/build/components/button/kbd.js +17 -15
  13. package/build/components/button/scss/index.scss +1 -1
  14. package/build/components/button/split.js +14 -16
  15. package/build/components/capslock/scss/index.scss +1 -1
  16. package/build/components/card/scss/index.scss +1 -1
  17. package/build/components/chat/minimap/index.js +4 -5
  18. package/build/components/checkbox/group.d.ts +1 -0
  19. package/build/components/checkbox/group.js +21 -20
  20. package/build/components/checkbox/scss/index.scss +1 -1
  21. package/build/components/color-picker/index.js +6 -6
  22. package/build/components/color-picker/scss/index.scss +1 -1
  23. package/build/components/command/index.d.ts +1 -1
  24. package/build/components/command/palette.d.ts +13 -9
  25. package/build/components/command/palette.js +143 -152
  26. package/build/components/command/scss/index.scss +1 -1
  27. package/build/components/command/search.d.ts +5 -7
  28. package/build/components/command/search.js +6 -26
  29. package/build/components/counter/scss/index.scss +1 -1
  30. package/build/components/editor/code/commands.js +1 -1
  31. package/build/components/editor/code/document.d.ts +1 -3
  32. package/build/components/editor/code/document.js +1 -1
  33. package/build/components/editor/code/editor.d.ts +18 -6
  34. package/build/components/editor/code/editor.js +9 -7
  35. package/build/components/editor/code/features.js +27 -18
  36. package/build/components/editor/code/find.d.ts +1 -1
  37. package/build/components/editor/code/find.js +5 -6
  38. package/build/components/editor/code/folding.d.ts +3 -5
  39. package/build/components/editor/code/folding.js +2 -15
  40. package/build/components/editor/code/gutter.js +2 -2
  41. package/build/components/editor/code/index.d.ts +1 -0
  42. package/build/components/editor/code/index.js +1 -0
  43. package/build/components/editor/code/minimap.d.ts +3 -1
  44. package/build/components/editor/code/minimap.js +31 -5
  45. package/build/components/editor/code/services/model.js +2 -1
  46. package/build/components/editor/code/syntax.js +2 -1
  47. package/build/components/editor/code/view.d.ts +8 -2
  48. package/build/components/editor/code/view.js +37 -56
  49. package/build/components/editor/diffs/index.d.ts +1 -0
  50. package/build/components/editor/diffs/index.js +1 -0
  51. package/build/components/editor/diffs/merge.js +16 -17
  52. package/build/components/editor/diffs/view.js +10 -11
  53. package/build/components/editor/markdown/editing.d.ts +2 -1
  54. package/build/components/editor/markdown/editing.js +14 -5
  55. package/build/components/editor/markdown/format.d.ts +1 -1
  56. package/build/components/editor/markdown/format.js +116 -26
  57. package/build/components/editor/markdown/layout.js +2 -1
  58. package/build/components/editor/markdown/model.d.ts +1 -2
  59. package/build/components/editor/markdown/model.js +1 -29
  60. package/build/components/editor/markdown/render.js +1 -1
  61. package/build/components/editor/markdown/template.d.ts +3 -10
  62. package/build/components/editor/markdown/template.js +2 -29
  63. package/build/components/editor/markdown/toolbar.d.ts +2 -2
  64. package/build/components/editor/markdown/toolbar.js +90 -126
  65. package/build/components/editor/markdown/view.d.ts +1 -1
  66. package/build/components/editor/markdown/view.js +54 -87
  67. package/build/components/editor/tree/drag.js +1 -1
  68. package/build/components/editor/tree/find.js +70 -64
  69. package/build/components/editor/tree/template.js +8 -7
  70. package/build/components/editor/viewer/model.d.ts +1 -1
  71. package/build/components/editor/viewer/template.js +4 -26
  72. package/build/components/editor/workspace/keybindings.d.ts +1 -1
  73. package/build/components/editor/workspace/model.d.ts +12 -2
  74. package/build/components/editor/workspace/model.js +87 -31
  75. package/build/components/editor/workspace/session.d.ts +2 -6
  76. package/build/components/editor/workspace/session.js +99 -16
  77. package/build/components/editor/workspace/status.d.ts +1 -1
  78. package/build/components/editor/workspace/strip.d.ts +10 -9
  79. package/build/components/editor/workspace/strip.js +99 -141
  80. package/build/components/editor/workspace/tabs.d.ts +2 -4
  81. package/build/components/editor/workspace/tabs.js +1 -14
  82. package/build/components/editor/workspace/template.d.ts +1 -1
  83. package/build/components/editor/workspace/template.js +305 -435
  84. package/build/components/error/index.d.ts +4 -13
  85. package/build/components/error/index.js +53 -172
  86. package/build/components/error/scss/index.scss +1 -1
  87. package/build/components/form/action.d.ts +2 -2
  88. package/build/components/form/action.js +2 -2
  89. package/build/components/form/input.d.ts +3 -3
  90. package/build/components/form/input.js +32 -10
  91. package/build/components/frame/scss/index.scss +1 -1
  92. package/build/components/group/index.js +96 -9
  93. package/build/components/group/scss/index.scss +1 -1
  94. package/build/components/heatmap/scss/index.scss +1 -1
  95. package/build/components/highlight/index.js +55 -48
  96. package/build/components/highlight/scss/index.scss +1 -1
  97. package/build/components/icon/scss/index.scss +1 -1
  98. package/build/components/image/scss/index.scss +1 -1
  99. package/build/components/index.d.ts +3 -6
  100. package/build/components/index.js +3 -6
  101. package/build/components/inline-edit/index.d.ts +2 -2
  102. package/build/components/inline-edit/index.js +5 -5
  103. package/build/components/inline-edit/rich.js +4 -4
  104. package/build/components/inline-edit/scss/index.scss +1 -1
  105. package/build/components/inline-edit/status.js +1 -0
  106. package/build/components/input/index.d.ts +4 -0
  107. package/build/components/input/index.js +3 -1
  108. package/build/components/input/otp.d.ts +18 -0
  109. package/build/components/input/otp.js +112 -0
  110. package/build/components/input/password.d.ts +15 -0
  111. package/build/components/input/password.js +163 -0
  112. package/build/components/input/scrub.d.ts +1 -0
  113. package/build/components/input/scrub.js +103 -89
  114. package/build/components/input/scss/index.scss +1 -1
  115. package/build/components/input/tag.d.ts +5 -0
  116. package/build/components/input/tag.js +116 -69
  117. package/build/components/json/download.js +1 -1
  118. package/build/components/link/scss/index.scss +1 -1
  119. package/build/components/marquee/index.js +1 -1
  120. package/build/components/marquee/scss/index.scss +1 -1
  121. package/build/components/nav/scss/index.scss +1 -1
  122. package/build/components/nav/tree.d.ts +2 -1
  123. package/build/components/nav/tree.js +6 -5
  124. package/build/components/notification/index.js +3 -3
  125. package/build/components/notification/scss/index.scss +1 -1
  126. package/build/components/overlay/popup.d.ts +2 -2
  127. package/build/components/overlay/popup.js +1 -1
  128. package/build/components/overlay/scss/index.scss +1 -1
  129. package/build/components/pagination/arrows.js +2 -3
  130. package/build/components/pagination/cards.js +2 -3
  131. package/build/components/pagination/index.d.ts +2 -3
  132. package/build/components/pagination/index.js +18 -13
  133. package/build/components/pagination/scss/index.scss +1 -1
  134. package/build/components/progress/index.js +1 -1
  135. package/build/components/progress/scss/index.scss +1 -1
  136. package/build/components/progress/text.js +3 -3
  137. package/build/components/range/filter.d.ts +7 -1
  138. package/build/components/range/filter.js +188 -171
  139. package/build/components/range/index.d.ts +14 -9
  140. package/build/components/range/index.js +11 -8
  141. package/build/components/range/scss/index.scss +1 -1
  142. package/build/components/range/surface.d.ts +21 -0
  143. package/build/components/range/surface.js +144 -0
  144. package/build/components/relative-time/index.js +2 -2
  145. package/build/components/relative-time/scss/index.scss +1 -1
  146. package/build/components/root/scss/index.scss +1 -1
  147. package/build/components/{preview/header.d.ts → search/button.d.ts} +3 -3
  148. package/build/components/search/button.js +18 -0
  149. package/build/components/search/index.d.ts +8 -0
  150. package/build/components/search/index.js +5 -0
  151. package/build/components/search/input.d.ts +9 -0
  152. package/build/components/search/input.js +23 -0
  153. package/build/components/search/parts.d.ts +5 -0
  154. package/build/components/search/parts.js +17 -0
  155. package/build/components/search/scss/index.scss +2 -0
  156. package/build/components/select/expand.js +4 -5
  157. package/build/components/select/index.d.ts +7 -7
  158. package/build/components/select/index.js +127 -117
  159. package/build/components/select/placement.js +8 -1
  160. package/build/components/select/scss/index.scss +1 -1
  161. package/build/components/{panels → shell}/group.d.ts +21 -5
  162. package/build/components/shell/group.js +336 -0
  163. package/build/components/shell/index.d.ts +15 -17
  164. package/build/components/shell/index.js +583 -238
  165. package/build/components/shell/model.d.ts +94 -0
  166. package/build/components/{panels → shell}/model.js +199 -73
  167. package/build/components/shell/resize.d.ts +5 -0
  168. package/build/components/{panels → shell}/resize.js +54 -30
  169. package/build/components/shell/scss/index.scss +1 -1
  170. package/build/components/shell/sidebar.d.ts +34 -0
  171. package/build/components/shell/sidebar.js +362 -0
  172. package/build/components/{panels → shell}/subtree.js +7 -8
  173. package/build/components/shortcut-recorder/index.d.ts +5 -4
  174. package/build/components/shortcut-recorder/index.js +69 -44
  175. package/build/components/shortcut-recorder/scss/index.scss +1 -1
  176. package/build/components/sortable/index.d.ts +16 -2
  177. package/build/components/sortable/index.js +237 -134
  178. package/build/components/sortable/scss/index.scss +1 -1
  179. package/build/components/story/index.js +46 -34
  180. package/build/components/story/scss/index.scss +1 -1
  181. package/build/components/surface-field/engine.d.ts +2 -0
  182. package/build/components/surface-field/engine.js +86 -33
  183. package/build/components/surface-field/index.d.ts +26 -4
  184. package/build/components/surface-field/index.js +35 -4
  185. package/build/components/surface-field/scss/index.scss +1 -1
  186. package/build/components/surface-field/surface.d.ts +13 -1
  187. package/build/components/surface-field/surface.js +149 -58
  188. package/build/components/tasklist/index.d.ts +1 -4
  189. package/build/components/tasklist/index.js +36 -43
  190. package/build/components/tasklist/scss/index.scss +1 -1
  191. package/build/components/textarea/index.d.ts +1 -1
  192. package/build/components/textarea/index.js +14 -14
  193. package/build/components/theme/scss/index.scss +1 -1
  194. package/build/components/theme/shared.d.ts +1 -2
  195. package/build/components/theme/shared.js +2 -5
  196. package/build/components/toast/index.d.ts +3 -3
  197. package/build/components/toast/index.js +3 -3
  198. package/build/components/toast/scss/index.scss +1 -1
  199. package/build/components/toolbar/index.d.ts +91 -0
  200. package/build/components/toolbar/index.js +1281 -0
  201. package/build/components/toolbar/scss/index.scss +2 -0
  202. package/build/components/tooltip/menu.d.ts +9 -8
  203. package/build/components/tooltip/menu.js +397 -279
  204. package/build/components/tooltip/onclick.d.ts +2 -0
  205. package/build/components/tooltip/onclick.js +13 -4
  206. package/build/components/tooltip/onhover.d.ts +3 -1
  207. package/build/components/tooltip/onhover.js +10 -9
  208. package/build/components/tooltip/scss/index.scss +1 -1
  209. package/build/components/tooltip/shared.d.ts +4 -4
  210. package/build/components/tooltip/shared.js +27 -46
  211. package/build/components/tooltip/utilities.d.ts +5 -2
  212. package/build/components/tooltip/utilities.js +169 -9
  213. package/build/components/typewriter/rotate.js +6 -6
  214. package/build/components/typewriter/scss/index.scss +1 -1
  215. package/build/components/uptime/scss/index.scss +1 -1
  216. package/build/components/usage-meter/index.js +1 -1
  217. package/build/components/usage-meter/scss/index.scss +1 -1
  218. package/build/css-utilities/font/montserrat/OFL.txt +93 -0
  219. package/build/shared/drag.d.ts +15 -9
  220. package/build/shared/drag.js +41 -28
  221. package/build/shared/placement.d.ts +39 -0
  222. package/build/shared/placement.js +55 -0
  223. package/build/shared/transition.js +1 -1
  224. package/build/shared/viewport.d.ts +1 -2
  225. package/build/shared/viewport.js +1 -4
  226. package/package.json +2 -5
  227. package/src/components/accordion/index.ts +12 -5
  228. package/src/components/announcement/index.ts +1 -1
  229. package/src/components/breadcrumb/index.ts +13 -3
  230. package/src/components/breadcrumb/scss/index.scss +6 -6
  231. package/src/components/breadcrumb/scss/variables.scss +7 -0
  232. package/src/components/button/kbd.ts +22 -17
  233. package/src/components/button/scss/index.scss +69 -76
  234. package/src/components/button/scss/variables.scss +51 -18
  235. package/src/components/button/split.ts +12 -8
  236. package/src/components/capslock/index.ts +2 -0
  237. package/src/components/capslock/scss/index.scss +21 -21
  238. package/src/components/card/scss/index.scss +16 -0
  239. package/src/components/card/scss/variables.scss +25 -2
  240. package/src/components/chat/minimap/index.ts +5 -6
  241. package/src/components/chat/minimap/scss/index.scss +12 -11
  242. package/src/components/chat/minimap/scss/variables.scss +23 -17
  243. package/src/components/checkbox/group.ts +8 -7
  244. package/src/components/checkbox/scss/index.scss +59 -35
  245. package/src/components/checkbox/scss/variables.scss +24 -17
  246. package/src/components/color-picker/index.ts +6 -6
  247. package/src/components/color-picker/scss/index.scss +35 -22
  248. package/src/components/color-picker/scss/variables.scss +11 -3
  249. package/src/components/command/index.ts +1 -1
  250. package/src/components/command/palette.ts +174 -166
  251. package/src/components/command/scss/index.scss +18 -51
  252. package/src/components/command/scss/variables.scss +37 -71
  253. package/src/components/command/search.ts +9 -31
  254. package/src/components/counter/index.ts +22 -22
  255. package/src/components/counter/scss/variables.scss +10 -7
  256. package/src/components/editor/code/commands.ts +1 -1
  257. package/src/components/editor/code/document.ts +0 -2
  258. package/src/components/editor/code/editor.ts +31 -13
  259. package/src/components/editor/code/features.ts +39 -24
  260. package/src/components/editor/code/find.ts +5 -6
  261. package/src/components/editor/code/folding.ts +3 -21
  262. package/src/components/editor/code/gutter.ts +2 -2
  263. package/src/components/editor/code/index.ts +1 -0
  264. package/src/components/editor/code/minimap.ts +39 -5
  265. package/src/components/editor/code/scss/_editor.scss +28 -21
  266. package/src/components/editor/code/scss/_features.scss +19 -21
  267. package/src/components/editor/code/scss/_services.scss +14 -11
  268. package/src/components/editor/code/scss/variables.scss +31 -12
  269. package/src/components/editor/code/services/model.ts +2 -1
  270. package/src/components/editor/code/syntax.ts +2 -1
  271. package/src/components/editor/code/view.ts +22 -45
  272. package/src/components/editor/diffs/index.ts +1 -0
  273. package/src/components/editor/diffs/merge.ts +9 -10
  274. package/src/components/editor/diffs/scss/_diffs.scss +39 -63
  275. package/src/components/editor/diffs/scss/_merge.scss +10 -2
  276. package/src/components/editor/diffs/scss/index.scss +0 -1
  277. package/src/components/editor/diffs/scss/variables.scss +36 -17
  278. package/src/components/editor/diffs/view.ts +8 -9
  279. package/src/components/editor/markdown/editing.ts +18 -6
  280. package/src/components/editor/markdown/format.ts +180 -32
  281. package/src/components/editor/markdown/layout.ts +2 -1
  282. package/src/components/editor/markdown/model.ts +0 -38
  283. package/src/components/editor/markdown/render.ts +1 -1
  284. package/src/components/editor/markdown/scss/index.scss +38 -52
  285. package/src/components/editor/markdown/scss/variables.scss +24 -50
  286. package/src/components/editor/markdown/template.ts +3 -63
  287. package/src/components/editor/markdown/toolbar.ts +76 -127
  288. package/src/components/editor/markdown/view.ts +9 -32
  289. package/src/components/editor/tree/drag.ts +1 -1
  290. package/src/components/editor/tree/find.ts +61 -64
  291. package/src/components/editor/tree/scss/index.scss +29 -30
  292. package/src/components/editor/tree/scss/variables.scss +34 -15
  293. package/src/components/editor/tree/template.ts +9 -9
  294. package/src/components/editor/viewer/model.ts +1 -1
  295. package/src/components/editor/viewer/scss/_viewer.scss +4 -5
  296. package/src/components/editor/viewer/scss/variables.scss +3 -3
  297. package/src/components/editor/viewer/template.ts +4 -31
  298. package/src/components/editor/workspace/keybindings.ts +1 -1
  299. package/src/components/editor/workspace/model.ts +136 -37
  300. package/src/components/editor/workspace/scss/_keybindings.scss +3 -20
  301. package/src/components/editor/workspace/scss/_status.scss +0 -1
  302. package/src/components/editor/workspace/scss/_tabs.scss +2 -41
  303. package/src/components/editor/workspace/scss/index.scss +49 -71
  304. package/src/components/editor/workspace/scss/variables.scss +1 -135
  305. package/src/components/editor/workspace/session.ts +138 -18
  306. package/src/components/editor/workspace/status.ts +1 -1
  307. package/src/components/editor/workspace/strip.ts +96 -115
  308. package/src/components/editor/workspace/tabs.ts +2 -23
  309. package/src/components/editor/workspace/template.ts +323 -458
  310. package/src/components/error/index.ts +47 -183
  311. package/src/components/error/scss/index.scss +34 -35
  312. package/src/components/error/scss/variables.scss +14 -26
  313. package/src/components/filter/scss/index.scss +6 -5
  314. package/src/components/form/action.ts +7 -7
  315. package/src/components/form/input.ts +25 -12
  316. package/src/components/frame/scss/index.scss +5 -5
  317. package/src/components/group/index.ts +77 -2
  318. package/src/components/group/scss/index.scss +164 -0
  319. package/src/components/group/scss/variables.scss +110 -2
  320. package/src/components/heatmap/scss/variables.scss +13 -10
  321. package/src/components/highlight/index.ts +87 -79
  322. package/src/components/highlight/scss/index.scss +6 -16
  323. package/src/components/highlight/scss/variables.scss +33 -5
  324. package/src/components/icon/scss/index.scss +2 -2
  325. package/src/components/icon/scss/variables.scss +14 -1
  326. package/src/components/image/scss/index.scss +9 -9
  327. package/src/components/image/scss/variables.scss +1 -1
  328. package/src/components/index.ts +3 -6
  329. package/src/components/inline-edit/index.ts +8 -6
  330. package/src/components/inline-edit/rich.ts +8 -8
  331. package/src/components/inline-edit/scss/index.scss +50 -36
  332. package/src/components/inline-edit/scss/variables.scss +28 -18
  333. package/src/components/inline-edit/status.ts +2 -0
  334. package/src/components/input/index.ts +3 -1
  335. package/src/components/input/otp.ts +175 -0
  336. package/src/components/input/password.ts +178 -0
  337. package/src/components/input/scrub.ts +197 -178
  338. package/src/components/input/scss/index.scss +344 -4
  339. package/src/components/input/scss/variables.scss +234 -65
  340. package/src/components/input/tag.ts +98 -53
  341. package/src/components/json/download.ts +2 -5
  342. package/src/components/link/scss/index.scss +3 -5
  343. package/src/components/loading/scss/index.scss +1 -0
  344. package/src/components/loading/scss/variables.scss +1 -0
  345. package/src/components/marquee/index.ts +1 -1
  346. package/src/components/marquee/scss/index.scss +11 -4
  347. package/src/components/nav/scss/index.scss +10 -26
  348. package/src/components/nav/scss/variables.scss +13 -23
  349. package/src/components/nav/tree.ts +10 -8
  350. package/src/components/notification/index.ts +3 -3
  351. package/src/components/notification/scss/index.scss +7 -14
  352. package/src/components/notification/scss/variables.scss +10 -2
  353. package/src/components/number/index.ts +1 -1
  354. package/src/components/overlay/popup.ts +2 -2
  355. package/src/components/overlay/scss/index.scss +60 -51
  356. package/src/components/page/scss/variables.scss +1 -0
  357. package/src/components/pagination/arrows.ts +2 -3
  358. package/src/components/pagination/cards.ts +2 -3
  359. package/src/components/pagination/index.ts +11 -9
  360. package/src/components/pagination/scss/index.scss +38 -101
  361. package/src/components/pagination/scss/variables.scss +24 -75
  362. package/src/components/progress/index.ts +1 -1
  363. package/src/components/progress/scss/index.scss +22 -11
  364. package/src/components/progress/scss/variables.scss +13 -5
  365. package/src/components/progress/text.ts +3 -3
  366. package/src/components/range/filter.ts +249 -246
  367. package/src/components/range/index.ts +22 -7
  368. package/src/components/range/scss/index.scss +470 -15
  369. package/src/components/range/scss/variables.scss +402 -198
  370. package/src/components/range/surface.ts +135 -0
  371. package/src/components/relative-time/index.ts +2 -2
  372. package/src/components/relative-time/scss/index.scss +4 -2
  373. package/src/components/relative-time/scss/variables.scss +4 -5
  374. package/src/components/root/scss/index.scss +11 -11
  375. package/src/components/root/scss/variables.scss +4 -4
  376. package/src/components/search/button.ts +24 -0
  377. package/src/components/search/index.ts +12 -0
  378. package/src/components/search/input.ts +35 -0
  379. package/src/components/search/parts.ts +24 -0
  380. package/src/components/search/scss/index.scss +36 -0
  381. package/src/components/search/scss/variables.scss +67 -0
  382. package/src/components/section/scss/variables.scss +1 -0
  383. package/src/components/select/expand.ts +3 -4
  384. package/src/components/select/index.ts +55 -41
  385. package/src/components/select/placement.ts +17 -1
  386. package/src/components/select/scss/index.scss +57 -29
  387. package/src/components/select/scss/variables.scss +91 -53
  388. package/src/components/{panels → shell}/group.ts +151 -98
  389. package/src/components/shell/index.ts +805 -284
  390. package/src/components/{panels → shell}/model.ts +329 -102
  391. package/src/components/shell/resize.ts +176 -0
  392. package/src/components/shell/scss/index.scss +502 -89
  393. package/src/components/shell/scss/variables.scss +264 -39
  394. package/src/components/shell/sidebar.ts +325 -0
  395. package/src/components/{panels → shell}/subtree.ts +1 -2
  396. package/src/components/shortcut-recorder/index.ts +99 -61
  397. package/src/components/shortcut-recorder/scss/index.scss +76 -52
  398. package/src/components/shortcut-recorder/scss/variables.scss +25 -30
  399. package/src/components/sortable/index.ts +364 -63
  400. package/src/components/sortable/scss/index.scss +22 -2
  401. package/src/components/sortable/scss/variables.scss +16 -4
  402. package/src/components/story/index.ts +56 -33
  403. package/src/components/story/scss/index.scss +67 -16
  404. package/src/components/story/scss/variables.scss +59 -18
  405. package/src/components/surface-field/engine.ts +157 -61
  406. package/src/components/surface-field/index.ts +64 -9
  407. package/src/components/surface-field/scss/index.scss +88 -77
  408. package/src/components/surface-field/scss/variables.scss +84 -36
  409. package/src/components/surface-field/surface.ts +225 -76
  410. package/src/components/tasklist/index.ts +10 -14
  411. package/src/components/tasklist/scss/index.scss +25 -45
  412. package/src/components/tasklist/scss/variables.scss +12 -29
  413. package/src/components/textarea/index.ts +39 -42
  414. package/src/components/theme/reveal.ts +1 -0
  415. package/src/components/theme/scss/index.scss +20 -16
  416. package/src/components/theme/scss/variables.scss +11 -5
  417. package/src/components/theme/shared.ts +3 -7
  418. package/src/components/toast/index.ts +7 -8
  419. package/src/components/toast/scss/index.scss +44 -36
  420. package/src/components/toast/scss/variables.scss +36 -33
  421. package/src/components/toolbar/index.ts +1675 -0
  422. package/src/components/toolbar/scss/index.scss +759 -0
  423. package/src/components/toolbar/scss/variables.scss +555 -0
  424. package/src/components/tooltip/menu.ts +301 -220
  425. package/src/components/tooltip/onclick.ts +18 -3
  426. package/src/components/tooltip/onhover.ts +13 -9
  427. package/src/components/tooltip/scss/index.scss +155 -188
  428. package/src/components/tooltip/scss/variables.scss +151 -135
  429. package/src/components/tooltip/shared.ts +47 -74
  430. package/src/components/tooltip/utilities.ts +151 -10
  431. package/src/components/truncate/index.ts +1 -1
  432. package/src/components/typewriter/rotate.ts +6 -6
  433. package/src/components/typewriter/scss/index.scss +14 -5
  434. package/src/components/uptime/scss/index.scss +8 -15
  435. package/src/components/uptime/scss/variables.scss +12 -1
  436. package/src/components/usage-meter/index.ts +1 -1
  437. package/src/components/usage-meter/scss/index.scss +6 -4
  438. package/src/components/usage-meter/scss/variables.scss +11 -11
  439. package/src/css-utilities/box-shadow.scss +0 -1
  440. package/src/css-utilities/icon.scss +9 -9
  441. package/src/css-utilities/surface.scss +27 -17
  442. package/src/modifiers/glass/index.ts +2 -2
  443. package/src/modifiers/glass/scss/index.scss +2 -2
  444. package/src/normalize/scss/index.scss +1 -1
  445. package/src/shared/drag.ts +92 -53
  446. package/src/shared/placement.ts +145 -0
  447. package/src/shared/transition.ts +1 -1
  448. package/src/shared/viewport.ts +1 -7
  449. package/src/tokens/scss/color.scss +2 -2
  450. package/src/tokens/scss/scale.scss +5 -1
  451. package/src/tokens/scss/size.scss +0 -7
  452. package/storage/svg/angle.svg +1 -0
  453. package/storage/svg/{chevron-left.svg → arrow.svg} +1 -1
  454. package/storage/svg/calendar.svg +1 -0
  455. package/storage/svg/circle-filled.svg +1 -0
  456. package/storage/svg/cursor-arrow-left.svg +1 -0
  457. package/storage/svg/cursor-arrow-right.svg +1 -0
  458. package/storage/svg/fit.svg +1 -0
  459. package/storage/svg/grip.svg +1 -0
  460. package/storage/svg/mail.svg +1 -0
  461. package/storage/svg/{chevron-down.svg → minus.svg} +1 -1
  462. package/storage/svg/music.svg +1 -0
  463. package/storage/svg/{chevron-up.svg → rotate-ccw.svg} +1 -1
  464. package/vite.config.ts +9 -13
  465. package/NOTICE +0 -232
  466. package/build/components/dock/index.d.ts +0 -47
  467. package/build/components/dock/index.js +0 -469
  468. package/build/components/dock/scss/index.scss +0 -2
  469. package/build/components/metric/flash.d.ts +0 -12
  470. package/build/components/metric/flash.js +0 -117
  471. package/build/components/metric/index.d.ts +0 -44
  472. package/build/components/metric/index.js +0 -275
  473. package/build/components/metric/scss/index.scss +0 -2
  474. package/build/components/pagination/dots.d.ts +0 -23
  475. package/build/components/pagination/dots.js +0 -115
  476. package/build/components/panels/dnd.d.ts +0 -47
  477. package/build/components/panels/dnd.js +0 -114
  478. package/build/components/panels/group.js +0 -322
  479. package/build/components/panels/index.d.ts +0 -17
  480. package/build/components/panels/index.js +0 -524
  481. package/build/components/panels/model.d.ts +0 -64
  482. package/build/components/panels/resize.d.ts +0 -9
  483. package/build/components/panels/scss/index.scss +0 -2
  484. package/build/components/preview/buttons.d.ts +0 -12
  485. package/build/components/preview/buttons.js +0 -26
  486. package/build/components/preview/code.d.ts +0 -8
  487. package/build/components/preview/code.js +0 -18
  488. package/build/components/preview/header.js +0 -21
  489. package/build/components/preview/index.d.ts +0 -37
  490. package/build/components/preview/index.js +0 -123
  491. package/build/components/preview/scss/index.scss +0 -2
  492. package/build/components/preview/source.d.ts +0 -12
  493. package/build/components/preview/source.js +0 -79
  494. package/build/components/preview/stage.d.ts +0 -8
  495. package/build/components/preview/stage.js +0 -28
  496. package/build/components/textarea/scss/index.scss +0 -2
  497. package/src/components/dock/index.ts +0 -567
  498. package/src/components/dock/scss/index.scss +0 -346
  499. package/src/components/dock/scss/variables.scss +0 -357
  500. package/src/components/input/scss/_field.scss +0 -39
  501. package/src/components/input/scss/_scrub.scss +0 -89
  502. package/src/components/input/scss/_tag.scss +0 -142
  503. package/src/components/metric/flash.ts +0 -129
  504. package/src/components/metric/index.ts +0 -307
  505. package/src/components/metric/scss/_flash.scss +0 -150
  506. package/src/components/metric/scss/index.scss +0 -155
  507. package/src/components/metric/scss/variables.scss +0 -233
  508. package/src/components/pagination/dots.ts +0 -132
  509. package/src/components/panels/dnd.ts +0 -190
  510. package/src/components/panels/index.ts +0 -676
  511. package/src/components/panels/resize.ts +0 -157
  512. package/src/components/panels/scss/index.scss +0 -379
  513. package/src/components/panels/scss/variables.scss +0 -197
  514. package/src/components/preview/buttons.ts +0 -48
  515. package/src/components/preview/code.ts +0 -28
  516. package/src/components/preview/header.ts +0 -23
  517. package/src/components/preview/index.ts +0 -149
  518. package/src/components/preview/scss/index.scss +0 -158
  519. package/src/components/preview/scss/variables.scss +0 -149
  520. package/src/components/preview/source.ts +0 -73
  521. package/src/components/preview/stage.ts +0 -33
  522. package/src/components/range/scss/_filter.scss +0 -360
  523. package/src/components/range/scss/_slider.scss +0 -65
  524. package/src/components/range/scss/_vertical.scss +0 -10
  525. package/src/components/textarea/scss/index.scss +0 -72
  526. package/src/components/textarea/scss/variables.scss +0 -22
  527. package/storage/svg/amex.svg +0 -1
  528. package/storage/svg/arrow-down.svg +0 -1
  529. package/storage/svg/arrow-left.svg +0 -1
  530. package/storage/svg/arrow-right.svg +0 -1
  531. package/storage/svg/arrow-up.svg +0 -1
  532. package/storage/svg/card.svg +0 -1
  533. package/storage/svg/chip.svg +0 -1
  534. package/storage/svg/discover.svg +0 -1
  535. package/storage/svg/mastercard.svg +0 -1
  536. package/storage/svg/visa.svg +0 -1
  537. /package/build/components/{panels → shell}/subtree.d.ts +0 -0
  538. /package/storage/svg/{chevron-right.svg → chevron.svg} +0 -0
@@ -1,13 +1,24 @@
1
1
  import { flush, reactive, read, root, signal, write, type ReactiveArray, type Signal } from '@esportsplus/reactivity';
2
2
  import { html, setProperties, type Attributes, type Element as Bound, type Renderable } from '@esportsplus/template';
3
3
  import { finished, measure, slides, timing } from '~/shared/animation';
4
+ import { coast, sample, velocity, type Direction, type Fling } from '~/shared/drag';
4
5
  import press from '~/shared/press';
5
6
  import './scss/index.scss';
6
7
 
7
8
 
9
+ // Letting a dragged item go over the middle of another hands the two to 'oncombine' instead of sorting them; from the
10
+ // moment the pointer reaches the middle, the other is marked 'sortable-item--target'. Read from the list the pointer is
11
+ // over. Sorting waits for the pointer to settle near an item's edge, so it can cross to the middle.
12
+ type Combine<T> = {
13
+ accepts?: (item: T, target: HTMLElement) => boolean;
14
+ // The item is out of 'source', where it sat at 'from', by now; its copy lands on 'target' once this returns.
15
+ oncombine: (item: T, target: HTMLElement, items: ReactiveArray<T>, from: number, source: ReactiveArray<T>) => void;
16
+ };
17
+
8
18
  // One container's list. A dragged item moves through the lists live, standing in its own place; the copy that
9
19
  // follows the pointer belongs to the list it was picked up from.
10
20
  type List<T> = {
21
+ combine?: Combine<T>;
11
22
  container?: HTMLElement;
12
23
  // The item dragged out of this list, shown by its copy until it has landed.
13
24
  dragging: Signal<T | null>;
@@ -32,6 +43,8 @@ type Motion = {
32
43
  left: number;
33
44
  origin: string;
34
45
  radius: string;
46
+ // Thrown out of its list: how much further it coasts, and for how long.
47
+ throw: Fling | null;
35
48
  top: number;
36
49
  width: number;
37
50
  x: number;
@@ -39,13 +52,33 @@ type Motion = {
39
52
  };
40
53
 
41
54
  type Options<T> = {
55
+ combine?: Combine<T>;
56
+ // Items that stay where they are: a press on one starts no drag, though others still sort past it.
57
+ disabled?: (item: T) => boolean;
42
58
  // Renders the copy that follows the pointer; the item's own template when omitted.
43
59
  drag?: (item: T) => Renderable<unknown>;
44
60
  // Containers sharing a group name trade items; the list the drag started in receives 'onsort'.
45
61
  group?: string;
46
62
  // Selector for the part of an item that starts a drag; the whole item when omitted.
47
63
  handle?: string;
64
+ // Once the dragged item has landed, after 'onsort', or the drag has stopped with its list gone.
65
+ onland?: (item: T) => void;
66
+ // As a drag lifts the item, its copy now following the pointer.
67
+ onlift?: (item: T) => void;
48
68
  onsort?: (item: T, from: number, to: number, source: ReactiveArray<T>, target: ReactiveArray<T>) => void;
69
+ // Let go outside every list, the item is thrown out of the one it was in, its copy coasting on and fading to
70
+ // nothing; called once the copy has gone. Without it, the item lands back in its place.
71
+ onthrow?: (item: T, from: number, items: ReactiveArray<T>) => void;
72
+ outside?: Outside<T>;
73
+ };
74
+
75
+ // Drop targets that aren't lists. While the pointer is over no list, 'over' names the target under the viewport point,
76
+ // which carries '--over'; letting go there takes the item out of the list it sits in and hands it to 'ondrop', its copy
77
+ // landing on the target's middle. A list with targets always hit-tests, even alone in its group.
78
+ type Outside<T> = {
79
+ // The item is out of 'source', where it sat at 'from', by now.
80
+ ondrop: (item: T, target: HTMLElement, from: number, source: ReactiveArray<T>) => void;
81
+ over: (item: T, x: number, y: number) => HTMLElement | null;
49
82
  };
50
83
 
51
84
  // 'index' is the item's place in its list.
@@ -60,6 +93,9 @@ type Rect = {
60
93
  };
61
94
 
62
95
 
96
+ // A throw may leave any way at all.
97
+ const ANYWHERE: Direction[] = [{ axis: 'x', sign: -1 }, { axis: 'x', sign: 1 }, { axis: 'y', sign: -1 }, { axis: 'y', sign: 1 }];
98
+
63
99
  // Touch has to hold still briefly before a drag starts, otherwise swiping across the items could never scroll.
64
100
  const DELAY = 180;
65
101
 
@@ -68,6 +104,15 @@ const ENTER = 0.15;
68
104
  // Treats the item as hanging below the grab point, so a centered grab still swings.
69
105
  const HANG = 0.5;
70
106
 
107
+ // How far in from each side an item's middle starts, as a share of its size.
108
+ const MIDDLE = 0.25;
109
+
110
+ // In a list that combines, how long the pointer rests, within 'SLOP', before the item sorts past another or moves into
111
+ // the list, ms. A pointer still on its way to an item's middle moves nothing out from under it.
112
+ const SETTLE = 200;
113
+
114
+ const SLOP = 6;
115
+
71
116
  // Seconds; low-pass on pointer velocity so uneven pointer/frame timing doesn't jolt the swing.
72
117
  const SMOOTHING = 0.04;
73
118
 
@@ -78,9 +123,11 @@ const SORTABLE_STATE = Symbol('sortable.root');
78
123
  let groups = new Map<string, Set<List<unknown>>>();
79
124
 
80
125
 
81
- function drag(source: List<unknown>, item: HTMLElement, value: unknown, e: PointerEvent, { group, onsort }: Options<unknown>) {
82
- // Whether this drag counts toward 'carrying'.
83
- let carried = false,
126
+ function drag(source: List<unknown>, item: HTMLElement, value: unknown, e: PointerEvent, { group, onland, onlift, onsort, onthrow, outside }: Options<unknown>) {
127
+ // The item in a combining list whose middle the pointer is over.
128
+ let aiming: HTMLElement | null = null,
129
+ // Whether this drag counts toward 'carrying'.
130
+ carried = false,
84
131
  // 'current' is the list the item sits in now.
85
132
  current = source,
86
133
  frame = 0,
@@ -91,15 +138,24 @@ function drag(source: List<unknown>, item: HTMLElement, value: unknown, e: Point
91
138
  lastTop = NaN,
92
139
  layout: Rect[] = [],
93
140
  lists = group ? [...(groups.get(group) ?? [source])] : [source],
141
+ // The target outside every list the pointer is over.
142
+ marked: HTMLElement | null = null,
143
+ // Combined with another item, or delivered to a target, so the press no longer ends the drag.
144
+ merged = false,
94
145
  motion = source.motion,
95
146
  originX = e.clientX,
96
147
  originY = e.clientY,
148
+ // What a combining list waits for the pointer to rest on before sorting past it or entering it: an item, or the
149
+ // list itself; since when, and from where.
150
+ pending: { key: unknown, since: number, x: number, y: number } | null = null,
97
151
  previousX = e.clientX,
98
152
  previousY = e.clientY,
99
153
  // From the container's CSS, read on lift; no duration is no slide.
100
154
  shift: KeyframeAnimationOptions | null = null,
101
155
  swing: ReturnType<typeof inertia> | null = null,
102
156
  time = 0,
157
+ // What a throw is let go at, sampled as an overlay's drag samples it.
158
+ tracked = velocity(),
103
159
  x = e.clientX,
104
160
  y = e.clientY;
105
161
 
@@ -117,6 +173,7 @@ function drag(source: List<unknown>, item: HTMLElement, value: unknown, e: Point
117
173
  motion.left = rect.left;
118
174
  motion.origin = `${originX - rect.left}px ${originY - rect.top}px`;
119
175
  motion.radius = computed.borderRadius;
176
+ motion.throw = null;
120
177
  motion.top = rect.top;
121
178
  motion.width = rect.width;
122
179
  motion.x = 0;
@@ -126,9 +183,21 @@ function drag(source: List<unknown>, item: HTMLElement, value: unknown, e: Point
126
183
  });
127
184
 
128
185
  carry(true);
186
+ onlift?.(value);
129
187
  frame = requestAnimationFrame(tick);
130
188
  }
131
189
 
190
+ // Marks the item the pointer is over in a combining list, which letting go combines with.
191
+ function aim(element: HTMLElement | null) {
192
+ if (element === aiming) {
193
+ return;
194
+ }
195
+
196
+ aiming?.classList.remove('sortable-item--target');
197
+ aiming = element;
198
+ element?.classList.add('sortable-item--target');
199
+ }
200
+
132
201
  // Marks the root from the lift until the copy starts landing. Not ':root:has(.sortable-drag)' in CSS: that makes
133
202
  // every DOM change anywhere on the page restyle the whole document.
134
203
  function carry(value: boolean) {
@@ -140,6 +209,41 @@ function drag(source: List<unknown>, item: HTMLElement, value: unknown, e: Point
140
209
  page().carrying += value ? 1 : -1;
141
210
  }
142
211
 
212
+ // Takes the item out of its list for the target outside every list it was let go over, landing its copy on the
213
+ // target's middle.
214
+ function deliver(target: HTMLElement, ondrop: Outside<unknown>['ondrop']) {
215
+ let ghost = source.ghost,
216
+ list = current,
217
+ from = list.items.indexOf(value);
218
+
219
+ merged = true;
220
+ mark(null);
221
+ reflow(() => {
222
+ list.items.splice(from, 1);
223
+ write(list.held, null);
224
+ });
225
+ ondrop(value, target, from, list.items);
226
+ flush();
227
+
228
+ if (ghost) {
229
+ let box = target.getBoundingClientRect();
230
+
231
+ motion.angle = 0;
232
+ motion.dropping = true;
233
+ motion.x = box.left + (box.width - motion.width) / 2 - motion.left;
234
+ motion.y = box.top + (box.height - motion.height) / 2 - motion.top;
235
+ flush();
236
+ }
237
+
238
+ carry(false);
239
+
240
+ void (ghost ? finished(ghost) : Promise.resolve()).then(() => {
241
+ write(source.dragging, null);
242
+ flush();
243
+ onland?.(value);
244
+ });
245
+ }
246
+
143
247
  function drop() {
144
248
  let ghost = source.ghost,
145
249
  slot = hole?.element;
@@ -194,6 +298,8 @@ function drag(source: List<unknown>, item: HTMLElement, value: unknown, e: Point
194
298
  if (onsort && (current !== source || to !== from)) {
195
299
  onsort(value, from, to, source.items, current.items);
196
300
  }
301
+
302
+ onland?.(value);
197
303
  });
198
304
  }
199
305
 
@@ -201,10 +307,8 @@ function drag(source: List<unknown>, item: HTMLElement, value: unknown, e: Point
201
307
  // rows above it, then those to its left in its own row.
202
308
  function enter(target: List<unknown>) {
203
309
  // The layout is still the last reflow's, in the list's own coordinates.
204
- let bounds = target.container!.getBoundingClientRect(),
205
- index = 0,
206
- left = x - bounds.left + target.container!.scrollLeft,
207
- top = y - bounds.top + target.container!.scrollTop;
310
+ let index = 0,
311
+ { left, top } = local(target);
208
312
 
209
313
  for (let i = 0, n = layout.length; i < n; i++) {
210
314
  let rect = layout[i];
@@ -221,29 +325,58 @@ function drag(source: List<unknown>, item: HTMLElement, value: unknown, e: Point
221
325
  function end(e: PointerEvent | null, started: boolean) {
222
326
  cancelAnimationFrame(frame);
223
327
 
224
- if (!started) {
328
+ if (!started || merged) {
225
329
  return;
226
330
  }
227
331
 
332
+ aim(null);
333
+
228
334
  if (e) {
229
- drop();
335
+ let list = over(),
336
+ target = !list && outside ? outside.over(value, x, y) : null,
337
+ combine = list?.combine,
338
+ point = list && local(list),
339
+ rect = list && point && combine ? under(list, point.left, point.top) : null;
340
+
341
+ if (target) {
342
+ deliver(target, outside!.ondrop);
343
+ }
344
+ else if (
345
+ list && point && rect && middle(rect, point.left, point.top) &&
346
+ (combine!.accepts?.(value, rect.element) ?? true)
347
+ ) {
348
+ merge(list, rect);
349
+ }
350
+ else if (onthrow && !hit()) {
351
+ toss(onthrow);
352
+ }
353
+ else {
354
+ drop();
355
+ }
356
+
230
357
  return;
231
358
  }
232
359
 
360
+ mark(null);
233
361
  write(current.held, null);
234
362
  write(source.dragging, null);
235
363
  carry(false);
364
+ onland?.(value);
236
365
  }
237
366
 
238
- function over() {
239
- if (lists.length === 1) {
240
- return source;
241
- }
242
-
367
+ // The list under the pointer, among those in sight.
368
+ function hit() {
243
369
  for (let i = 0, n = lists.length; i < n; i++) {
244
- let rect = lists[i].container?.getBoundingClientRect();
370
+ let container = lists[i].container;
371
+
372
+ // A list faded or hidden out of sight still holds its box, which can lie over another list's.
373
+ if (!container?.checkVisibility({ opacityProperty: true, visibilityProperty: true })) {
374
+ continue;
375
+ }
376
+
377
+ let rect = container.getBoundingClientRect();
245
378
 
246
- if (rect && x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom) {
379
+ if (x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom) {
247
380
  return lists[i];
248
381
  }
249
382
  }
@@ -251,6 +384,79 @@ function drag(source: List<unknown>, item: HTMLElement, value: unknown, e: Point
251
384
  return null;
252
385
  }
253
386
 
387
+ // The pointer in a list's own coordinates, which its layout is measured in.
388
+ function local(list: List<unknown>) {
389
+ let bounds = list.container!.getBoundingClientRect();
390
+
391
+ return { left: x - bounds.left + list.container!.scrollLeft, top: y - bounds.top + list.container!.scrollTop };
392
+ }
393
+
394
+ function mark(element: HTMLElement | null) {
395
+ if (element === marked) {
396
+ return;
397
+ }
398
+
399
+ marked?.classList.remove('--over');
400
+ marked = element;
401
+ element?.classList.add('--over');
402
+ }
403
+
404
+ // Hands the item to its list's 'oncombine' with the one under it. It leaves its own list first, so the others close
405
+ // up, and its copy lands on the other as a drop lands on its slot.
406
+ function merge(list: List<unknown>, rect: Rect) {
407
+ let ghost = source.ghost,
408
+ sitting = current,
409
+ from = sitting.items.indexOf(value);
410
+
411
+ merged = true;
412
+ cancelAnimationFrame(frame);
413
+ aim(null);
414
+ reflow(() => {
415
+ sitting.items.splice(from, 1);
416
+ write(sitting.held, null);
417
+ });
418
+
419
+ // Where it rests once the others have closed up, not partway through sliding there.
420
+ for (let animation of rect.element.getAnimations()) {
421
+ animation.finish();
422
+ }
423
+
424
+ let box = rect.element.getBoundingClientRect();
425
+
426
+ list.combine!.oncombine(value, rect.element, list.items, from, sitting.items);
427
+ flush();
428
+
429
+ if (ghost) {
430
+ motion.angle = 0;
431
+ motion.dropping = true;
432
+ motion.height = box.height;
433
+ motion.width = box.width;
434
+ motion.x = box.left - motion.left;
435
+ motion.y = box.top - motion.top;
436
+ flush();
437
+ }
438
+
439
+ carry(false);
440
+
441
+ void (ghost ? finished(ghost) : Promise.resolve()).then(() => {
442
+ write(source.dragging, null);
443
+ flush();
444
+ onland?.(value);
445
+ });
446
+ }
447
+
448
+ // Whether a point falls in an item's middle, where holding it combines rather than sorts.
449
+ function middle(rect: Rect, left: number, top: number) {
450
+ let insetX = (rect.right - rect.left) * MIDDLE,
451
+ insetY = (rect.bottom - rect.top) * MIDDLE;
452
+
453
+ return left > rect.left + insetX && left < rect.right - insetX && top > rect.top + insetY && top < rect.bottom - insetY;
454
+ }
455
+
456
+ function over() {
457
+ return lists.length === 1 && !outside ? source : hit();
458
+ }
459
+
254
460
  function reflow(mutate: VoidFunction) {
255
461
  for (let i = 0, n = lists.length; i < n; i++) {
256
462
  measure(lists[i].container?.children ?? []);
@@ -283,8 +489,9 @@ function drag(source: List<unknown>, item: HTMLElement, value: unknown, e: Point
283
489
  top = bounds.top - parent.scrollTop;
284
490
 
285
491
  for (let element of parent.children as HTMLCollectionOf<HTMLElement>) {
286
- // Only the items: the copy is a child too, out in the top layer.
287
- if (!element.classList.contains('sortable-drag')) {
492
+ // Only the items: the copy is a child too, out in the top layer, and a container may hold more than its
493
+ // items.
494
+ if (element.classList.contains('sortable-item')) {
288
495
  elements.push(element);
289
496
  places.push({ index: index++, left, list, top });
290
497
  }
@@ -315,6 +522,17 @@ function drag(source: List<unknown>, item: HTMLElement, value: unknown, e: Point
315
522
  }
316
523
  }
317
524
 
525
+ // Whether the pointer has rested on 'key' for 'SETTLE', straying no further than 'SLOP' from where it settled.
526
+ function rested(key: unknown, now: number) {
527
+ let rest = pending;
528
+
529
+ if (!rest || rest.key !== key || Math.hypot(x - rest.x, y - rest.y) > SLOP) {
530
+ rest = pending = { key, since: now, x, y };
531
+ }
532
+
533
+ return now - rest.since >= SETTLE;
534
+ }
535
+
318
536
  // Within its list the item is sorted into place, keeping its node and the touch dragging it; into another it is
319
537
  // spliced, rendering afresh there.
320
538
  function relocate(target: List<unknown>, to: number) {
@@ -336,60 +554,87 @@ function drag(source: List<unknown>, item: HTMLElement, value: unknown, e: Point
336
554
  current = target;
337
555
  }
338
556
 
339
- function sort() {
557
+ function sort(now: number) {
340
558
  let slot = hole,
341
559
  target = over();
342
560
 
343
- if (!slot || !target) {
561
+ if (!target) {
562
+ aim(null);
563
+ mark(outside?.over(value, x, y) ?? null);
564
+ pending = null;
344
565
  return;
345
566
  }
346
567
 
347
- if (target !== current) {
568
+ mark(null);
569
+
570
+ if (!slot) {
571
+ aim(null);
572
+ pending = null;
573
+ return;
574
+ }
575
+
576
+ let combine = target.combine;
577
+
578
+ // Into another list at once, unless it combines: then only once the pointer rests there, so one carried in
579
+ // over an item's middle, to combine with it, doesn't push that item aside.
580
+ if (target !== current && !combine) {
348
581
  reflow(() => enter(target));
349
582
  return;
350
583
  }
351
584
 
352
- let bounds = target.container!.getBoundingClientRect(),
353
- left = x - bounds.left + target.container!.scrollLeft,
354
- top = y - bounds.top + target.container!.scrollTop;
585
+ let { left, top } = local(target);
355
586
 
356
- // Nothing moved under the pointer: not the pointer, the page or the list's own scroll.
357
- if (left === lastLeft && top === lastTop) {
587
+ // Nothing moved under the pointer: not the pointer, the page or the list's own scroll. A combining list still
588
+ // counts the time it rests.
589
+ if (left === lastLeft && top === lastTop && !combine) {
358
590
  return;
359
591
  }
360
592
 
361
593
  lastLeft = left;
362
594
  lastTop = top;
363
595
 
364
- for (let i = 0, n = layout.length; i < n; i++) {
365
- let rect = layout[i];
596
+ let rect = under(target, left, top);
366
597
 
367
- if (
368
- rect === slot ||
369
- rect.list !== target ||
370
- left < rect.left ||
371
- left > rect.right ||
372
- top < rect.top ||
373
- top > rect.bottom
374
- ) {
375
- continue;
376
- }
598
+ if (combine && rect && middle(rect, left, top) && (combine.accepts?.(value, rect.element) ?? true)) {
599
+ aim(rect.element);
600
+ pending = null;
601
+ return;
602
+ }
377
603
 
378
- let row = rect.top < slot.bottom && rect.bottom > slot.top,
379
- depth = row
380
- ? (rect.left > slot.left ? left - rect.left : rect.right - left)
381
- : (rect.top > slot.top ? top - rect.top : rect.bottom - top),
382
- size = row ? rect.right - rect.left : rect.bottom - rect.top;
383
-
384
- // How far the pointer must travel into the hovered item (from the edge facing the held one) before
385
- // they swap. Same-size items swap almost on entry; a larger item needs half its surplus over the held
386
- // one, which leaves the pointer short of the swap-back point afterwards.
387
- if (depth > Math.max(0, (size - (row ? slot.right - slot.left : slot.bottom - slot.top)) / 2) + size * ENTER) {
388
- reflow(() => relocate(target, rect.index));
604
+ aim(null);
605
+
606
+ if (target !== current) {
607
+ if (rested(target, now)) {
608
+ reflow(() => enter(target));
389
609
  }
390
610
 
391
611
  return;
392
612
  }
613
+
614
+ if (!rect) {
615
+ pending = null;
616
+ return;
617
+ }
618
+
619
+ if (combine && !rested(rect.element, now)) {
620
+ return;
621
+ }
622
+
623
+ let row = rect.top < slot.bottom && rect.bottom > slot.top,
624
+ depth = row
625
+ ? (rect.left > slot.left ? left - rect.left : rect.right - left)
626
+ : (rect.top > slot.top ? top - rect.top : rect.bottom - top),
627
+ size = row ? rect.right - rect.left : rect.bottom - rect.top;
628
+
629
+ // How far the pointer must travel into the hovered item (from the edge facing the held one) before they swap.
630
+ // Same-size items swap almost on entry; a larger item needs half its surplus over the held one, which leaves
631
+ // the pointer short of the swap-back point afterwards.
632
+ if (depth > Math.max(0, (size - (row ? slot.right - slot.left : slot.bottom - slot.top)) / 2) + size * ENTER) {
633
+ let index = rect.index;
634
+
635
+ pending = null;
636
+ reflow(() => relocate(target, index));
637
+ }
393
638
  }
394
639
 
395
640
  function tick(now: number) {
@@ -406,7 +651,50 @@ function drag(source: List<unknown>, item: HTMLElement, value: unknown, e: Point
406
651
  motion.x = x - originX;
407
652
  motion.y = y - originY;
408
653
 
409
- sort();
654
+ sort(now);
655
+ }
656
+
657
+ // Out of its list at once, so the items around it close up. The copy coasts on at the speed it was thrown,
658
+ // shrinking and fading to nothing; without a coast (reduced motion) it fades where it is.
659
+ function toss(thrown: NonNullable<Options<unknown>['onthrow']>) {
660
+ let ghost = source.ghost,
661
+ list = current,
662
+ from = list.items.indexOf(value);
663
+
664
+ if (ghost) {
665
+ let fade = timing(getComputedStyle(ghost), 'throw-fade');
666
+
667
+ motion.throw = coast(ghost, { ...tracked, directions: ANYWHERE, x: x - originX, y: y - originY })
668
+ ?? { duration: (fade?.duration as number | undefined) ?? 0, easing: fade?.easing ?? 'linear', x: 0, y: 0 };
669
+ flush();
670
+ carry(false);
671
+ }
672
+
673
+ reflow(() => {
674
+ list.items.splice(from, 1);
675
+ write(list.held, null);
676
+ });
677
+
678
+ void (ghost ? finished(ghost) : Promise.resolve()).then(() => {
679
+ write(source.dragging, null);
680
+ flush();
681
+ carry(false);
682
+ thrown(value, from, list.items);
683
+ onland?.(value);
684
+ });
685
+ }
686
+
687
+ // The item of 'list' under a point in its coordinates, other than the one held.
688
+ function under(list: List<unknown>, left: number, top: number) {
689
+ for (let i = 0, n = layout.length; i < n; i++) {
690
+ let rect = layout[i];
691
+
692
+ if (rect !== hole && rect.list === list && left >= rect.left && left <= rect.right && top >= rect.top && top <= rect.bottom) {
693
+ return rect;
694
+ }
695
+ }
696
+
697
+ return null;
410
698
  }
411
699
 
412
700
  source.press.begin(e, {
@@ -414,6 +702,7 @@ function drag(source: List<unknown>, item: HTMLElement, value: unknown, e: Point
414
702
  move: (e) => {
415
703
  x = e.clientX;
416
704
  y = e.clientY;
705
+ sample(tracked, x - originX, y - originY);
417
706
  },
418
707
  start: activate
419
708
  });
@@ -469,19 +758,20 @@ function page() {
469
758
 
470
759
 
471
760
  // Spread 'attributes' on the container and render the items inside it; each item renders one element, with the
472
- // attributes its template is handed spread on it. Dropping reorders 'items', or moves an item between the lists of a
473
- // group. A move between lists splices it out of one array and into the other, so a reactive object moved that way is
474
- // disposed with its old place.
761
+ // attributes its template is handed spread on it, which mark it 'sortable-item'. Other children of the container stay
762
+ // where they are. Dropping reorders 'items', or moves an item between the lists of a group. A move between lists
763
+ // splices it out of one array and into the other, so a reactive object moved that way is disposed with its old place.
475
764
  export default <T>(
476
765
  items: ReactiveArray<T>,
477
766
  template: (item: T, attributes: Attributes) => Renderable<unknown>,
478
- { drag: copy, group, handle, onsort }: Options<T> = {}
767
+ { combine, disabled, drag: copy, group, handle, onland, onlift, onsort, onthrow, outside }: Options<T> = {}
479
768
  ) => {
480
769
  let list: List<T> = {
770
+ combine,
481
771
  dragging: signal<T | null>(null),
482
772
  held: signal<T | null>(null),
483
773
  items,
484
- motion: reactive({ angle: 0, dropping: false, height: 0, left: 0, origin: '', radius: '', top: 0, width: 0, x: 0, y: 0 }),
774
+ motion: reactive({ angle: 0, dropping: false, height: 0, left: 0, origin: '', radius: '', throw: null, top: 0, width: 0, x: 0, y: 0 } as Motion),
485
775
  press: press(DELAY),
486
776
  revealing: signal<T | null>(null)
487
777
  };
@@ -496,7 +786,7 @@ export default <T>(
496
786
  inert
497
787
  popover='manual'
498
788
  ${{
499
- class: () => motion.dropping && 'sortable-drag--dropping',
789
+ class: [() => motion.dropping && 'sortable-drag--dropping', () => motion.throw && 'sortable-drag--thrown'],
500
790
  onconnect: (element: HTMLElement) => {
501
791
  list.ghost = element;
502
792
  element.showPopover();
@@ -509,7 +799,8 @@ export default <T>(
509
799
  },
510
800
  style: [
511
801
  () => `--sortable-height: ${motion.height}px; --sortable-left: ${motion.left}px; --sortable-origin: ${motion.origin}; --sortable-radius: ${motion.radius}; --sortable-top: ${motion.top}px; --sortable-width: ${motion.width}px;`,
512
- () => `--sortable-angle: ${motion.angle}deg; --sortable-x: ${motion.x}px; --sortable-y: ${motion.y}px;`
802
+ () => `--sortable-angle: ${motion.angle}deg; --sortable-x: ${motion.x}px; --sortable-y: ${motion.y}px;`,
803
+ () => motion.throw && `--sortable-throw-duration: ${motion.throw.duration}ms; --sortable-throw-easing: ${motion.throw.easing}; --sortable-throw-x: ${motion.throw.x}px; --sortable-throw-y: ${motion.throw.y}px;`
513
804
  ]
514
805
  }}
515
806
  >
@@ -523,13 +814,16 @@ export default <T>(
523
814
  // item with its own, keeps the press from this one.
524
815
  function hold(item: T): Attributes {
525
816
  return {
526
- class: () => signal.selector(list.held, item)
527
- ? 'sortable-item--held'
528
- : signal.selector(list.revealing, item) && 'sortable-item--revealing',
817
+ class: [
818
+ 'sortable-item',
819
+ () => signal.selector(list.held, item)
820
+ ? 'sortable-item--held'
821
+ : signal.selector(list.revealing, item) && 'sortable-item--revealing'
822
+ ],
529
823
  onpointerdown: (e: PointerEvent) => {
530
824
  let element = e.currentTarget as HTMLElement;
531
825
 
532
- if (e.button !== 0 || !e.isPrimary || list.press.busy() || read(list.dragging) !== null) {
826
+ if (e.button !== 0 || !e.isPrimary || list.press.busy() || read(list.dragging) !== null || disabled?.(item)) {
533
827
  return;
534
828
  }
535
829
 
@@ -537,7 +831,14 @@ export default <T>(
537
831
  return;
538
832
  }
539
833
 
540
- drag(list as List<unknown>, element, item, e, { group, onsort: onsort as Options<unknown>['onsort'] });
834
+ drag(list as List<unknown>, element, item, e, {
835
+ group,
836
+ onland: onland as Options<unknown>['onland'],
837
+ onlift: onlift as Options<unknown>['onlift'],
838
+ onsort: onsort as Options<unknown>['onsort'],
839
+ onthrow: onthrow as Options<unknown>['onthrow'],
840
+ outside: outside as Options<unknown>['outside']
841
+ });
541
842
  }
542
843
  };
543
844
  }
@@ -586,4 +887,4 @@ export default <T>(
586
887
  };
587
888
 
588
889
 
589
- export type { Options as SortableOptions };
890
+ export type { Combine as SortableCombine, Options as SortableOptions, Outside as SortableOutside };