@human-kit/ui 1.0.0-beta.0 → 1.0.0-beta.10

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 (558) hide show
  1. package/README.md +29 -16
  2. package/dist/FOCUS_STATE_CONTRACT.md +18 -4
  3. package/dist/FOCUS_STATE_REVIEW_TEMPLATE.md +8 -8
  4. package/dist/accordion/README.md +3 -3
  5. package/dist/accordion/root/accordion-root.svelte +15 -3
  6. package/dist/accordion/root/context.svelte.js +4 -4
  7. package/dist/accordion/types.d.ts +40 -19
  8. package/dist/autocomplete/README.md +6 -7
  9. package/dist/autocomplete/empty/autocomplete-empty.svelte +1 -1
  10. package/dist/autocomplete/empty/autocomplete-empty.svelte.d.ts +1 -1
  11. package/dist/autocomplete/input/autocomplete-input.svelte +3 -3
  12. package/dist/autocomplete/input/autocomplete-input.svelte.d.ts +3 -3
  13. package/dist/autocomplete/item/autocomplete-item.svelte +10 -0
  14. package/dist/autocomplete/item-indicator/autocomplete-item-indicator.svelte +2 -2
  15. package/dist/autocomplete/item-indicator/autocomplete-item-indicator.svelte.d.ts +2 -2
  16. package/dist/autocomplete/list/autocomplete-list.svelte +2 -2
  17. package/dist/autocomplete/list/autocomplete-list.svelte.d.ts +11 -3
  18. package/dist/autocomplete/root/autocomplete.svelte +7 -7
  19. package/dist/autocomplete/root/autocomplete.svelte.d.ts +7 -7
  20. package/dist/autocomplete/status/autocomplete-status.svelte +1 -1
  21. package/dist/autocomplete/status/autocomplete-status.svelte.d.ts +1 -1
  22. package/dist/avatar/README.md +52 -0
  23. package/dist/avatar/count/avatar-count.svelte +56 -0
  24. package/dist/avatar/count/avatar-count.svelte.d.ts +4 -0
  25. package/dist/avatar/fallback/avatar-fallback.svelte +67 -0
  26. package/dist/avatar/fallback/avatar-fallback.svelte.d.ts +4 -0
  27. package/dist/avatar/group/avatar-group.svelte +65 -0
  28. package/dist/avatar/group/avatar-group.svelte.d.ts +4 -0
  29. package/dist/avatar/group/context.d.ts +15 -0
  30. package/dist/avatar/group/context.js +15 -0
  31. package/dist/avatar/image/avatar-image.svelte +104 -0
  32. package/dist/avatar/image/avatar-image.svelte.d.ts +4 -0
  33. package/dist/avatar/index.d.ts +22 -0
  34. package/dist/avatar/index.js +10 -0
  35. package/dist/avatar/index.parts.d.ts +5 -0
  36. package/dist/avatar/index.parts.js +5 -0
  37. package/dist/avatar/root/avatar-root.svelte +79 -0
  38. package/dist/avatar/root/avatar-root.svelte.d.ts +4 -0
  39. package/dist/avatar/root/context.d.ts +14 -0
  40. package/dist/avatar/root/context.js +15 -0
  41. package/dist/avatar/types.d.ts +84 -0
  42. package/dist/avatar/types.js +1 -0
  43. package/dist/breadcrumbs/README.md +65 -0
  44. package/dist/breadcrumbs/ellipsis/breadcrumbs-ellipsis.svelte +62 -0
  45. package/dist/breadcrumbs/ellipsis/breadcrumbs-ellipsis.svelte.d.ts +4 -0
  46. package/dist/breadcrumbs/index.d.ts +23 -0
  47. package/dist/breadcrumbs/index.js +10 -0
  48. package/dist/breadcrumbs/index.parts.d.ts +6 -0
  49. package/dist/breadcrumbs/index.parts.js +6 -0
  50. package/dist/breadcrumbs/item/breadcrumbs-item.svelte +42 -0
  51. package/dist/breadcrumbs/item/breadcrumbs-item.svelte.d.ts +4 -0
  52. package/dist/breadcrumbs/link/breadcrumbs-link.svelte +47 -0
  53. package/dist/breadcrumbs/link/breadcrumbs-link.svelte.d.ts +4 -0
  54. package/dist/breadcrumbs/list/breadcrumbs-list.svelte +31 -0
  55. package/dist/breadcrumbs/list/breadcrumbs-list.svelte.d.ts +4 -0
  56. package/dist/breadcrumbs/root/breadcrumbs-root.svelte +112 -0
  57. package/dist/breadcrumbs/root/breadcrumbs-root.svelte.d.ts +4 -0
  58. package/dist/breadcrumbs/root/context.d.ts +19 -0
  59. package/dist/breadcrumbs/root/context.js +15 -0
  60. package/dist/breadcrumbs/separator/breadcrumbs-separator.svelte +35 -0
  61. package/dist/breadcrumbs/separator/breadcrumbs-separator.svelte.d.ts +4 -0
  62. package/dist/breadcrumbs/types.d.ts +80 -0
  63. package/dist/breadcrumbs/types.js +1 -0
  64. package/dist/button/README.md +1 -1
  65. package/dist/button/root/button-root.svelte +37 -7
  66. package/dist/button/root/button-root.svelte.d.ts +19 -4
  67. package/dist/calendar/README.md +3 -3
  68. package/dist/calendar/body-cell/calendar-body-cell.svelte +7 -0
  69. package/dist/calendar/grid-header/calendar-grid-header.svelte +3 -4
  70. package/dist/calendar/grid-header/calendar-grid-header.svelte.d.ts +3 -4
  71. package/dist/calendar/root/calendar-root.svelte +8 -2
  72. package/dist/calendar/root/calendar-root.svelte.d.ts +8 -2
  73. package/dist/calendar/root/context.svelte.js +8 -2
  74. package/dist/calendar/trigger-next/README.md +1 -1
  75. package/dist/calendar/trigger-previous/README.md +1 -1
  76. package/dist/checkbox/README.md +1 -1
  77. package/dist/checkbox/indicator/README.md +1 -1
  78. package/dist/checkbox/indicator/checkbox-indicator.svelte +1 -0
  79. package/dist/checkbox/indicator/checkbox-indicator.svelte.d.ts +1 -0
  80. package/dist/checkbox/root/README.md +2 -2
  81. package/dist/checkbox/root/checkbox-root.svelte +133 -38
  82. package/dist/checkbox/root/checkbox-root.svelte.d.ts +21 -1
  83. package/dist/checkbox-group/README.md +95 -0
  84. package/dist/checkbox-group/index.d.ts +15 -0
  85. package/dist/checkbox-group/index.js +6 -0
  86. package/dist/checkbox-group/index.parts.d.ts +4 -0
  87. package/dist/checkbox-group/index.parts.js +7 -0
  88. package/dist/checkbox-group/label/checkbox-group-label.svelte +36 -0
  89. package/dist/checkbox-group/label/checkbox-group-label.svelte.d.ts +4 -0
  90. package/dist/checkbox-group/root/checkbox-group-root.svelte +118 -0
  91. package/dist/checkbox-group/root/checkbox-group-root.svelte.d.ts +4 -0
  92. package/dist/checkbox-group/root/context.svelte.d.ts +52 -0
  93. package/dist/checkbox-group/root/context.svelte.js +251 -0
  94. package/dist/checkbox-group/types.d.ts +57 -0
  95. package/dist/checkbox-group/types.js +1 -0
  96. package/dist/clock/README.md +3 -3
  97. package/dist/clock/axis/README.md +1 -1
  98. package/dist/clock/root/README.md +1 -1
  99. package/dist/clock/root/create-time-selection-state.svelte.d.ts +5 -0
  100. package/dist/clock/root/create-time-selection-state.svelte.js +113 -10
  101. package/dist/clock/root/wheel-options.d.ts +7 -3
  102. package/dist/clock/root/wheel-options.js +7 -15
  103. package/dist/clock/wheel-column/clock-wheel-column.svelte +10 -2
  104. package/dist/clock/wheel-column/clock-wheel-column.svelte.d.ts +2 -1
  105. package/dist/collapsible/README.md +3 -3
  106. package/dist/collapsible/root/collapsible-root.svelte +9 -4
  107. package/dist/collapsible/types.d.ts +13 -1
  108. package/dist/combobox/README.md +2 -2
  109. package/dist/combobox/button/README.md +6 -6
  110. package/dist/combobox/input/README.md +1 -1
  111. package/dist/combobox/input/combobox-input.svelte +15 -4
  112. package/dist/combobox/input/combobox-input.svelte.d.ts +3 -3
  113. package/dist/combobox/item/combobox-listboxitem.svelte +4 -2
  114. package/dist/combobox/item/combobox-listboxitem.svelte.d.ts +4 -2
  115. package/dist/combobox/item-indicator/README.md +1 -1
  116. package/dist/combobox/item-indicator/combobox-item-indicator.svelte +2 -2
  117. package/dist/combobox/item-indicator/combobox-item-indicator.svelte.d.ts +2 -2
  118. package/dist/combobox/list/combobox-listbox.svelte +98 -3
  119. package/dist/combobox/list/combobox-listbox.svelte.d.ts +28 -3
  120. package/dist/combobox/popover/README.md +1 -1
  121. package/dist/combobox/popover/combobox-popover.svelte +4 -56
  122. package/dist/combobox/root/README.md +24 -24
  123. package/dist/combobox/root/combobox.svelte +138 -56
  124. package/dist/combobox/root/combobox.svelte.d.ts +31 -11
  125. package/dist/combobox/root/context.d.ts +12 -0
  126. package/dist/combobox/status/README.md +3 -3
  127. package/dist/combobox/status/combobox-status.svelte +1 -1
  128. package/dist/combobox/status/combobox-status.svelte.d.ts +1 -1
  129. package/dist/combobox/tag/README.md +1 -1
  130. package/dist/combobox/tag/combobox-tag.svelte +1 -1
  131. package/dist/combobox/tag/combobox-tag.svelte.d.ts +1 -1
  132. package/dist/combobox/tag-remove/README.md +1 -1
  133. package/dist/combobox/tag-remove/combobox-tag-remove.svelte +14 -3
  134. package/dist/combobox/tag-remove/combobox-tag-remove.svelte.d.ts +7 -1
  135. package/dist/combobox/tags/README.md +1 -1
  136. package/dist/combobox/tags/combobox-tags.svelte +15 -12
  137. package/dist/combobox/tags/combobox-tags.svelte.d.ts +12 -10
  138. package/dist/combobox/trigger/README.md +7 -7
  139. package/dist/combobox/trigger/combobox-trigger.svelte +4 -1
  140. package/dist/datepicker/README.md +5 -4
  141. package/dist/datepicker/input/date-picker-input.svelte +3 -4
  142. package/dist/datepicker/input/date-picker-input.svelte.d.ts +3 -4
  143. package/dist/datepicker/root/date-picker-root.svelte +38 -2
  144. package/dist/datepicker/root/date-picker-root.svelte.d.ts +2 -0
  145. package/dist/datepicker/root/draft-evaluation.d.ts +7 -0
  146. package/dist/datepicker/root/draft-evaluation.js +2 -2
  147. package/dist/datepicker/trigger/README.md +1 -1
  148. package/dist/daterangepicker/README.md +3 -3
  149. package/dist/daterangepicker/input/date-range-picker-input.svelte +3 -4
  150. package/dist/daterangepicker/input/date-range-picker-input.svelte.d.ts +3 -4
  151. package/dist/daterangepicker/root/date-range-picker-root.svelte +19 -1
  152. package/dist/daterangepicker/root/date-range-picker-root.svelte.d.ts +2 -0
  153. package/dist/dialog/README.md +10 -2
  154. package/dist/dialog/close/dialog-close.svelte +57 -0
  155. package/dist/dialog/close/dialog-close.svelte.d.ts +19 -0
  156. package/dist/dialog/content/dialog-content.svelte +6 -4
  157. package/dist/dialog/content/dialog-content.svelte.d.ts +4 -4
  158. package/dist/dialog/description/dialog-description.svelte +46 -0
  159. package/dist/dialog/description/dialog-description.svelte.d.ts +20 -0
  160. package/dist/dialog/index.d.ts +9 -0
  161. package/dist/dialog/index.js +3 -0
  162. package/dist/dialog/index.parts.d.ts +3 -0
  163. package/dist/dialog/index.parts.js +3 -0
  164. package/dist/dialog/overlay/dialog-overlay.svelte +1 -1
  165. package/dist/dialog/overlay/dialog-overlay.svelte.d.ts +1 -1
  166. package/dist/dialog/portal/dialog-portal.svelte +1 -1
  167. package/dist/dialog/portal/dialog-portal.svelte.d.ts +1 -1
  168. package/dist/dialog/root/README.md +1 -1
  169. package/dist/dialog/root/context.d.ts +8 -0
  170. package/dist/dialog/root/dialog-root.svelte +100 -20
  171. package/dist/dialog/root/dialog-root.svelte.d.ts +15 -6
  172. package/dist/dialog/root/dialog-stack.d.ts +6 -22
  173. package/dist/dialog/root/dialog-stack.js +4 -33
  174. package/dist/dialog/title/dialog-title.svelte +43 -0
  175. package/dist/dialog/title/dialog-title.svelte.d.ts +21 -0
  176. package/dist/dialog/trigger/README.md +1 -1
  177. package/dist/drawer/README.md +111 -0
  178. package/dist/drawer/body/drawer-body.svelte +47 -0
  179. package/dist/drawer/body/drawer-body.svelte.d.ts +32 -0
  180. package/dist/drawer/close/drawer-close.svelte +52 -0
  181. package/dist/drawer/close/drawer-close.svelte.d.ts +20 -0
  182. package/dist/drawer/content/drawer-content.svelte +600 -0
  183. package/dist/drawer/content/drawer-content.svelte.d.ts +31 -0
  184. package/dist/drawer/description/drawer-description.svelte +40 -0
  185. package/dist/drawer/description/drawer-description.svelte.d.ts +20 -0
  186. package/dist/drawer/indent/drawer-indent-background.svelte +36 -0
  187. package/dist/drawer/indent/drawer-indent-background.svelte.d.ts +17 -0
  188. package/dist/drawer/indent/drawer-indent.svelte +59 -0
  189. package/dist/drawer/indent/drawer-indent.svelte.d.ts +32 -0
  190. package/dist/drawer/index.d.ts +49 -0
  191. package/dist/drawer/index.js +25 -0
  192. package/dist/drawer/index.parts.d.ts +14 -0
  193. package/dist/drawer/index.parts.js +15 -0
  194. package/dist/drawer/overlay/drawer-overlay.svelte +67 -0
  195. package/dist/drawer/overlay/drawer-overlay.svelte.d.ts +12 -0
  196. package/dist/drawer/portal/drawer-portal.svelte +57 -0
  197. package/dist/drawer/portal/drawer-portal.svelte.d.ts +13 -0
  198. package/dist/drawer/root/context.d.ts +81 -0
  199. package/dist/drawer/root/context.js +20 -0
  200. package/dist/drawer/root/drawer-root.svelte +348 -0
  201. package/dist/drawer/root/drawer-root.svelte.d.ts +79 -0
  202. package/dist/drawer/root/drawer-stack.svelte.d.ts +73 -0
  203. package/dist/drawer/root/drawer-stack.svelte.js +113 -0
  204. package/dist/drawer/root/handle.svelte.d.ts +39 -0
  205. package/dist/drawer/root/handle.svelte.js +64 -0
  206. package/dist/drawer/root/keyboard-context.d.ts +13 -0
  207. package/dist/drawer/root/keyboard-context.js +8 -0
  208. package/dist/drawer/root/presence-context.d.ts +22 -0
  209. package/dist/drawer/root/presence-context.js +8 -0
  210. package/dist/drawer/root/snap-points.d.ts +68 -0
  211. package/dist/drawer/root/snap-points.js +120 -0
  212. package/dist/drawer/root/starting-style.svelte.d.ts +18 -0
  213. package/dist/drawer/root/starting-style.svelte.js +38 -0
  214. package/dist/drawer/root/types.d.ts +36 -0
  215. package/dist/drawer/root/types.js +1 -0
  216. package/dist/drawer/root/viewport-context.d.ts +2 -0
  217. package/dist/drawer/root/viewport-context.js +16 -0
  218. package/dist/drawer/swipe-area/drawer-swipe-area.svelte +143 -0
  219. package/dist/drawer/swipe-area/drawer-swipe-area.svelte.d.ts +22 -0
  220. package/dist/drawer/title/drawer-title.svelte +37 -0
  221. package/dist/drawer/title/drawer-title.svelte.d.ts +21 -0
  222. package/dist/drawer/trigger/drawer-trigger.svelte +90 -0
  223. package/dist/drawer/trigger/drawer-trigger.svelte.d.ts +41 -0
  224. package/dist/drawer/viewport/drawer-viewport.svelte +69 -0
  225. package/dist/drawer/viewport/drawer-viewport.svelte.d.ts +15 -0
  226. package/dist/drawer/virtual-keyboard/drawer-virtual-keyboard-provider.svelte +88 -0
  227. package/dist/drawer/virtual-keyboard/drawer-virtual-keyboard-provider.svelte.d.ts +29 -0
  228. package/dist/dropzone/README.md +4 -6
  229. package/dist/hooks/use-virtual-focus.svelte.d.ts +9 -0
  230. package/dist/hooks/use-virtual-focus.svelte.js +7 -1
  231. package/dist/index.d.ts +24 -0
  232. package/dist/index.js +23 -0
  233. package/dist/input/input.svelte +6 -6
  234. package/dist/input/input.svelte.d.ts +6 -6
  235. package/dist/internal/environment.d.ts +11 -0
  236. package/dist/internal/environment.js +14 -0
  237. package/dist/internal/localized-strings.d.ts +152 -0
  238. package/dist/internal/localized-strings.js +152 -0
  239. package/dist/internal/number-precision.d.ts +9 -0
  240. package/dist/internal/number-precision.js +27 -0
  241. package/dist/listbox/README.md +20 -1
  242. package/dist/listbox/item/listbox-item.svelte +43 -18
  243. package/dist/listbox/item/listbox-item.svelte.d.ts +24 -15
  244. package/dist/listbox/root/README.md +1 -1
  245. package/dist/listbox/root/context.d.ts +56 -1
  246. package/dist/listbox/root/context.js +118 -1
  247. package/dist/listbox/root/listbox.svelte +400 -27
  248. package/dist/listbox/root/listbox.svelte.d.ts +73 -16
  249. package/dist/locale-provider/README.md +1 -6
  250. package/dist/menu/README.md +41 -4
  251. package/dist/menu/content/menu-content.svelte +31 -14
  252. package/dist/menu/content/menu-content.svelte.d.ts +14 -9
  253. package/dist/menu/context-trigger/menu-context-trigger.svelte +194 -0
  254. package/dist/menu/context-trigger/menu-context-trigger.svelte.d.ts +35 -0
  255. package/dist/menu/group/menu-group-label.svelte +1 -1
  256. package/dist/menu/group/menu-group-label.svelte.d.ts +1 -1
  257. package/dist/menu/index.d.ts +4 -1
  258. package/dist/menu/index.js +1 -0
  259. package/dist/menu/index.parts.d.ts +1 -0
  260. package/dist/menu/index.parts.js +1 -0
  261. package/dist/menu/item/menu-item.svelte +11 -8
  262. package/dist/menu/item/menu-item.svelte.d.ts +11 -8
  263. package/dist/menu/overlay/menu-overlay.svelte +2 -2
  264. package/dist/menu/overlay/menu-overlay.svelte.d.ts +1 -1
  265. package/dist/menu/root/context.d.ts +24 -3
  266. package/dist/menu/root/focus-state.d.ts +2 -2
  267. package/dist/menu/root/focus-state.js +8 -32
  268. package/dist/menu/root/menu-root.svelte +14 -8
  269. package/dist/menu/root/menu-root.svelte.d.ts +14 -8
  270. package/dist/menu/root/menu-state.svelte.d.ts +1 -1
  271. package/dist/menu/root/menu-state.svelte.js +24 -1
  272. package/dist/menu/separator/menu-separator.svelte +1 -1
  273. package/dist/menu/separator/menu-separator.svelte.d.ts +1 -1
  274. package/dist/menu/submenu/menu-submenu-root.svelte +10 -7
  275. package/dist/menu/submenu/menu-submenu-root.svelte.d.ts +10 -7
  276. package/dist/numberfield/root/README.md +1 -1
  277. package/dist/numberfield/root/number-field-root.svelte +2 -1
  278. package/dist/numberfield/root/number-utils.js +1 -20
  279. package/dist/numberfield/scrub-area-cursor/README.md +1 -1
  280. package/dist/popover/README.md +1 -1
  281. package/dist/popover/content/popover-content.svelte +22 -16
  282. package/dist/popover/content/popover-content.svelte.d.ts +19 -14
  283. package/dist/popover/overlay/popover-overlay.svelte +2 -2
  284. package/dist/popover/overlay/popover-overlay.svelte.d.ts +1 -1
  285. package/dist/popover/root/README.md +1 -1
  286. package/dist/popover/root/focus-state.d.ts +2 -2
  287. package/dist/popover/root/focus-state.js +7 -34
  288. package/dist/popover/root/popover-root.svelte +29 -14
  289. package/dist/popover/root/popover-root.svelte.d.ts +16 -5
  290. package/dist/popover/trigger/README.md +1 -1
  291. package/dist/primitives/aria-hide-outside.d.ts +13 -0
  292. package/dist/primitives/aria-hide-outside.js +7 -1
  293. package/dist/primitives/contain-wheel.d.ts +9 -0
  294. package/dist/primitives/contain-wheel.js +41 -0
  295. package/dist/primitives/floating.d.ts +49 -8
  296. package/dist/primitives/floating.js +75 -7
  297. package/dist/primitives/focus-trap.d.ts +2 -0
  298. package/dist/primitives/focus-trap.js +7 -1
  299. package/dist/primitives/focus-visible.svelte.d.ts +14 -0
  300. package/dist/primitives/focus-visible.svelte.js +19 -0
  301. package/dist/primitives/index.d.ts +3 -0
  302. package/dist/primitives/index.js +3 -0
  303. package/dist/primitives/input-modality.d.ts +7 -0
  304. package/dist/primitives/input-modality.js +32 -5
  305. package/dist/primitives/keyboard-navigation.d.ts +29 -5
  306. package/dist/primitives/keyboard-navigation.js +27 -17
  307. package/dist/primitives/layer-stack.d.ts +29 -0
  308. package/dist/primitives/layer-stack.js +35 -0
  309. package/dist/primitives/list-virtualizer.d.ts +75 -0
  310. package/dist/primitives/list-virtualizer.js +59 -0
  311. package/dist/primitives/long-press.d.ts +59 -0
  312. package/dist/primitives/long-press.js +142 -0
  313. package/dist/primitives/presence.svelte.js +6 -1
  314. package/dist/primitives/scroll-lock.d.ts +47 -3
  315. package/dist/primitives/scroll-lock.js +191 -9
  316. package/dist/primitives/swipe-gesture.d.ts +126 -0
  317. package/dist/primitives/swipe-gesture.js +351 -0
  318. package/dist/primitives/text.d.ts +8 -0
  319. package/dist/primitives/text.js +13 -0
  320. package/dist/primitives/trigger-focus-state.d.ts +29 -0
  321. package/dist/primitives/trigger-focus-state.js +57 -0
  322. package/dist/progress/README.md +54 -0
  323. package/dist/progress/index.d.ts +21 -0
  324. package/dist/progress/index.js +9 -0
  325. package/dist/progress/index.parts.d.ts +5 -0
  326. package/dist/progress/index.parts.js +5 -0
  327. package/dist/progress/indicator/progress-indicator.svelte +37 -0
  328. package/dist/progress/indicator/progress-indicator.svelte.d.ts +4 -0
  329. package/dist/progress/label/progress-label.svelte +34 -0
  330. package/dist/progress/label/progress-label.svelte.d.ts +4 -0
  331. package/dist/progress/root/context.d.ts +26 -0
  332. package/dist/progress/root/context.js +15 -0
  333. package/dist/progress/root/progress-root.svelte +136 -0
  334. package/dist/progress/root/progress-root.svelte.d.ts +4 -0
  335. package/dist/progress/root/progress-utils.d.ts +12 -0
  336. package/dist/progress/root/progress-utils.js +41 -0
  337. package/dist/progress/track/progress-track.svelte +27 -0
  338. package/dist/progress/track/progress-track.svelte.d.ts +4 -0
  339. package/dist/progress/types.d.ts +81 -0
  340. package/dist/progress/types.js +1 -0
  341. package/dist/progress/value/progress-value.svelte +36 -0
  342. package/dist/progress/value/progress-value.svelte.d.ts +4 -0
  343. package/dist/radio-group/README.md +103 -0
  344. package/dist/radio-group/index.d.ts +18 -0
  345. package/dist/radio-group/index.js +9 -0
  346. package/dist/radio-group/index.parts.d.ts +4 -0
  347. package/dist/radio-group/index.parts.js +4 -0
  348. package/dist/radio-group/indicator/radio-group-indicator.svelte +43 -0
  349. package/dist/radio-group/indicator/radio-group-indicator.svelte.d.ts +12 -0
  350. package/dist/radio-group/item/context.d.ts +18 -0
  351. package/dist/radio-group/item/context.js +15 -0
  352. package/dist/radio-group/item/radio-group-item.svelte +377 -0
  353. package/dist/radio-group/item/radio-group-item.svelte.d.ts +35 -0
  354. package/dist/radio-group/label/radio-group-label.svelte +37 -0
  355. package/dist/radio-group/label/radio-group-label.svelte.d.ts +4 -0
  356. package/dist/radio-group/root/context.svelte.d.ts +57 -0
  357. package/dist/radio-group/root/context.svelte.js +284 -0
  358. package/dist/radio-group/root/radio-group-root.svelte +193 -0
  359. package/dist/radio-group/root/radio-group-root.svelte.d.ts +4 -0
  360. package/dist/radio-group/types.d.ts +50 -0
  361. package/dist/radio-group/types.js +1 -0
  362. package/dist/select/README.md +129 -0
  363. package/dist/select/index.d.ts +30 -0
  364. package/dist/select/index.js +16 -0
  365. package/dist/select/index.parts.d.ts +8 -0
  366. package/dist/select/index.parts.js +9 -0
  367. package/dist/select/item/select-item.svelte +68 -0
  368. package/dist/select/item/select-item.svelte.d.ts +10 -0
  369. package/dist/select/item-indicator/select-item-indicator.svelte +55 -0
  370. package/dist/select/item-indicator/select-item-indicator.svelte.d.ts +4 -0
  371. package/dist/select/label/select-label.svelte +46 -0
  372. package/dist/select/label/select-label.svelte.d.ts +4 -0
  373. package/dist/select/list/select-list.svelte +241 -0
  374. package/dist/select/list/select-list.svelte.d.ts +62 -0
  375. package/dist/select/popover/select-popover.svelte +80 -0
  376. package/dist/select/popover/select-popover.svelte.d.ts +9 -0
  377. package/dist/select/root/context.d.ts +106 -0
  378. package/dist/select/root/context.js +22 -0
  379. package/dist/select/root/select-root.svelte +544 -0
  380. package/dist/select/root/select-root.svelte.d.ts +25 -0
  381. package/dist/select/trigger/select-trigger.svelte +192 -0
  382. package/dist/select/trigger/select-trigger.svelte.d.ts +4 -0
  383. package/dist/select/types.d.ts +133 -0
  384. package/dist/select/types.js +1 -0
  385. package/dist/select/value/select-value.svelte +61 -0
  386. package/dist/select/value/select-value.svelte.d.ts +4 -0
  387. package/dist/separator/README.md +35 -0
  388. package/dist/separator/index.d.ts +7 -0
  389. package/dist/separator/index.js +3 -0
  390. package/dist/separator/separator.svelte +254 -0
  391. package/dist/separator/separator.svelte.d.ts +45 -0
  392. package/dist/separator/types.d.ts +1 -0
  393. package/dist/separator/types.js +1 -0
  394. package/dist/slider/README.md +61 -0
  395. package/dist/slider/fill/slider-fill.svelte +40 -0
  396. package/dist/slider/fill/slider-fill.svelte.d.ts +4 -0
  397. package/dist/slider/index.d.ts +9 -0
  398. package/dist/slider/index.js +8 -0
  399. package/dist/slider/index.parts.d.ts +6 -0
  400. package/dist/slider/index.parts.js +6 -0
  401. package/dist/slider/label/slider-label.svelte +44 -0
  402. package/dist/slider/label/slider-label.svelte.d.ts +4 -0
  403. package/dist/slider/output/slider-output.svelte +46 -0
  404. package/dist/slider/output/slider-output.svelte.d.ts +4 -0
  405. package/dist/slider/root/context.d.ts +106 -0
  406. package/dist/slider/root/context.js +15 -0
  407. package/dist/slider/root/slider-root.svelte +545 -0
  408. package/dist/slider/root/slider-root.svelte.d.ts +4 -0
  409. package/dist/slider/root/slider-utils.d.ts +57 -0
  410. package/dist/slider/root/slider-utils.js +88 -0
  411. package/dist/slider/thumb/slider-thumb.svelte +276 -0
  412. package/dist/slider/thumb/slider-thumb.svelte.d.ts +4 -0
  413. package/dist/slider/track/slider-track.svelte +60 -0
  414. package/dist/slider/track/slider-track.svelte.d.ts +4 -0
  415. package/dist/slider/types.d.ts +144 -0
  416. package/dist/slider/types.js +1 -0
  417. package/dist/switch/root/README.md +2 -2
  418. package/dist/switch/root/switch-root.svelte +49 -21
  419. package/dist/switch/root/switch-root.svelte.d.ts +26 -14
  420. package/dist/switch/thumb/switch-thumb.svelte +1 -1
  421. package/dist/switch/thumb/switch-thumb.svelte.d.ts +1 -1
  422. package/dist/table/README.md +16 -9
  423. package/dist/table/body/table-body.svelte +84 -9
  424. package/dist/table/cell/table-cell.svelte +27 -10
  425. package/dist/table/checkbox/table-checkbox.svelte +3 -0
  426. package/dist/table/checkbox-indicator/README.md +1 -1
  427. package/dist/table/column/table-column.svelte +5 -1
  428. package/dist/table/column-header-cell/table-column-header-cell.svelte +24 -0
  429. package/dist/table/column-resizer/README.md +2 -2
  430. package/dist/table/column-resizer/table-column-resizer.svelte +1 -5
  431. package/dist/table/index.d.ts +1 -1
  432. package/dist/table/index.js +1 -1
  433. package/dist/table/interactive-cell/table-interactive-cell.svelte +26 -10
  434. package/dist/table/root/README.md +1 -1
  435. package/dist/table/root/context.svelte.d.ts +17 -0
  436. package/dist/table/root/context.svelte.js +212 -66
  437. package/dist/table/root/table-root.svelte +36 -6
  438. package/dist/table/row/table-row.svelte +14 -14
  439. package/dist/table/sort-trigger/README.md +1 -1
  440. package/dist/table/sort-trigger/table-sort-trigger.svelte +5 -1
  441. package/dist/table/types.d.ts +32 -14
  442. package/dist/tabs/root/tabs-root.svelte +20 -6
  443. package/dist/tabs/types.d.ts +9 -0
  444. package/dist/timepicker/README.md +3 -2
  445. package/dist/timepicker/input/README.md +1 -1
  446. package/dist/timepicker/input/time-picker-input.svelte +66 -5
  447. package/dist/timepicker/input/time-picker-input.svelte.d.ts +18 -1
  448. package/dist/timepicker/root/README.md +1 -1
  449. package/dist/timepicker/root/time-picker-root.svelte +11 -0
  450. package/dist/timepicker/root/time-picker-root.svelte.d.ts +2 -0
  451. package/dist/timepicker/trigger/README.md +1 -1
  452. package/dist/toast/README.md +75 -0
  453. package/dist/toast/action/toast-action.svelte +42 -0
  454. package/dist/toast/action/toast-action.svelte.d.ts +4 -0
  455. package/dist/toast/close/toast-close.svelte +41 -0
  456. package/dist/toast/close/toast-close.svelte.d.ts +4 -0
  457. package/dist/toast/content/toast-content.svelte +24 -0
  458. package/dist/toast/content/toast-content.svelte.d.ts +4 -0
  459. package/dist/toast/description/toast-description.svelte +41 -0
  460. package/dist/toast/description/toast-description.svelte.d.ts +4 -0
  461. package/dist/toast/index.d.ts +34 -0
  462. package/dist/toast/index.js +15 -0
  463. package/dist/toast/index.parts.d.ts +9 -0
  464. package/dist/toast/index.parts.js +9 -0
  465. package/dist/toast/positioner/toast-positioner.svelte +75 -0
  466. package/dist/toast/positioner/toast-positioner.svelte.d.ts +4 -0
  467. package/dist/toast/provider/context.d.ts +36 -0
  468. package/dist/toast/provider/context.js +22 -0
  469. package/dist/toast/provider/toast-manager.svelte.d.ts +113 -0
  470. package/dist/toast/provider/toast-manager.svelte.js +210 -0
  471. package/dist/toast/provider/toast-provider.svelte +98 -0
  472. package/dist/toast/provider/toast-provider.svelte.d.ts +4 -0
  473. package/dist/toast/root/context.d.ts +18 -0
  474. package/dist/toast/root/context.js +15 -0
  475. package/dist/toast/root/toast-root.svelte +296 -0
  476. package/dist/toast/root/toast-root.svelte.d.ts +4 -0
  477. package/dist/toast/title/toast-title.svelte +38 -0
  478. package/dist/toast/title/toast-title.svelte.d.ts +4 -0
  479. package/dist/toast/types.d.ts +100 -0
  480. package/dist/toast/types.js +1 -0
  481. package/dist/toast/viewport/toast-viewport.svelte +389 -0
  482. package/dist/toast/viewport/toast-viewport.svelte.d.ts +4 -0
  483. package/dist/toggle/README.md +1 -1
  484. package/dist/toggle/root/toggle-root.svelte +28 -0
  485. package/dist/toggle/root/toggle-root.svelte.d.ts +19 -0
  486. package/dist/toggle-group/README.md +12 -4
  487. package/dist/toggle-group/index.d.ts +2 -0
  488. package/dist/toggle-group/index.parts.d.ts +1 -0
  489. package/dist/toggle-group/index.parts.js +4 -0
  490. package/dist/toggle-group/root/context.svelte.d.ts +1 -1
  491. package/dist/toggle-group/root/context.svelte.js +24 -8
  492. package/dist/toggle-group/root/toggle-group-root.svelte +24 -4
  493. package/dist/toggle-group/root/toggle-group-teardown-order-child.svelte +13 -0
  494. package/dist/toggle-group/root/toggle-group-teardown-order-child.svelte.d.ts +7 -0
  495. package/dist/toggle-group/types.d.ts +9 -0
  496. package/dist/tooltip/README.md +53 -0
  497. package/dist/tooltip/arrow/tooltip-arrow.svelte +36 -0
  498. package/dist/tooltip/arrow/tooltip-arrow.svelte.d.ts +4 -0
  499. package/dist/tooltip/content/tooltip-content.svelte +148 -0
  500. package/dist/tooltip/content/tooltip-content.svelte.d.ts +4 -0
  501. package/dist/tooltip/index.d.ts +8 -0
  502. package/dist/tooltip/index.js +7 -0
  503. package/dist/tooltip/index.parts.d.ts +5 -0
  504. package/dist/tooltip/index.parts.js +5 -0
  505. package/dist/tooltip/provider/tooltip-provider.svelte +36 -0
  506. package/dist/tooltip/provider/tooltip-provider.svelte.d.ts +4 -0
  507. package/dist/tooltip/root/context.d.ts +46 -0
  508. package/dist/tooltip/root/context.js +22 -0
  509. package/dist/tooltip/root/safe-polygon.d.ts +26 -0
  510. package/dist/tooltip/root/safe-polygon.js +66 -0
  511. package/dist/tooltip/root/tooltip-group.d.ts +26 -0
  512. package/dist/tooltip/root/tooltip-group.js +41 -0
  513. package/dist/tooltip/root/tooltip-root.svelte +461 -0
  514. package/dist/tooltip/root/tooltip-root.svelte.d.ts +4 -0
  515. package/dist/tooltip/trigger/tooltip-trigger.svelte +52 -0
  516. package/dist/tooltip/trigger/tooltip-trigger.svelte.d.ts +4 -0
  517. package/dist/tooltip/types.d.ts +105 -0
  518. package/dist/tooltip/types.js +1 -0
  519. package/dist/transfer-list/README.md +110 -0
  520. package/dist/transfer-list/index.d.ts +33 -0
  521. package/dist/transfer-list/index.js +18 -0
  522. package/dist/transfer-list/index.parts.d.ts +9 -0
  523. package/dist/transfer-list/index.parts.js +10 -0
  524. package/dist/transfer-list/item/transfer-list-item.svelte +74 -0
  525. package/dist/transfer-list/item/transfer-list-item.svelte.d.ts +35 -0
  526. package/dist/transfer-list/list/transfer-list-list.svelte +162 -0
  527. package/dist/transfer-list/list/transfer-list-list.svelte.d.ts +56 -0
  528. package/dist/transfer-list/list/transfer-list-source.svelte +13 -0
  529. package/dist/transfer-list/list/transfer-list-source.svelte.d.ts +36 -0
  530. package/dist/transfer-list/list/transfer-list-target.svelte +14 -0
  531. package/dist/transfer-list/list/transfer-list-target.svelte.d.ts +36 -0
  532. package/dist/transfer-list/move/transfer-list-move-all.svelte +14 -0
  533. package/dist/transfer-list/move/transfer-list-move-all.svelte.d.ts +10 -0
  534. package/dist/transfer-list/move/transfer-list-move-button.svelte +103 -0
  535. package/dist/transfer-list/move/transfer-list-move-button.svelte.d.ts +25 -0
  536. package/dist/transfer-list/move/transfer-list-move-down.svelte +14 -0
  537. package/dist/transfer-list/move/transfer-list-move-down.svelte.d.ts +10 -0
  538. package/dist/transfer-list/move/transfer-list-move-selected.svelte +14 -0
  539. package/dist/transfer-list/move/transfer-list-move-selected.svelte.d.ts +10 -0
  540. package/dist/transfer-list/move/transfer-list-move-up.svelte +14 -0
  541. package/dist/transfer-list/move/transfer-list-move-up.svelte.d.ts +10 -0
  542. package/dist/transfer-list/move/transfer-list-reorder-button.svelte +83 -0
  543. package/dist/transfer-list/move/transfer-list-reorder-button.svelte.d.ts +21 -0
  544. package/dist/transfer-list/root/context.d.ts +70 -0
  545. package/dist/transfer-list/root/context.js +24 -0
  546. package/dist/transfer-list/root/transfer-list-root.svelte +345 -0
  547. package/dist/transfer-list/root/transfer-list-root.svelte.d.ts +68 -0
  548. package/dist/transfer-list/root/types.d.ts +22 -0
  549. package/dist/transfer-list/root/types.js +4 -0
  550. package/dist/transfer-list/status/transfer-list-status.svelte +70 -0
  551. package/dist/transfer-list/status/transfer-list-status.svelte.d.ts +15 -0
  552. package/dist/tree/README.md +3 -3
  553. package/dist/tree/checkbox-indicator/README.md +1 -1
  554. package/dist/tree/root/README.md +1 -1
  555. package/dist/tree/root/context.svelte.js +6 -0
  556. package/dist/tree/root/tree-root.svelte +22 -8
  557. package/dist/tree/types.d.ts +23 -1
  558. package/package.json +282 -224
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Detached trigger handles.
3
+ *
4
+ * Normally a `Drawer.Trigger` lives inside the `Drawer.Root` it opens. That breaks
5
+ * down when the openers are scattered — a row action in every line of a table, say,
6
+ * each needing to open the same drawer with a different record. Duplicating the
7
+ * whole drawer per row is wasteful and puts several modal panels in the DOM at once.
8
+ *
9
+ * A handle is the shared object in between: triggers push into it, one root reads
10
+ * from it, and the value the trigger carried arrives as the root's `payload`.
11
+ *
12
+ * ```svelte
13
+ * <script>
14
+ * const profile = createDrawerHandle();
15
+ * </script>
16
+ *
17
+ * {#each users as user}
18
+ * <Drawer.Trigger handle={profile} payload={user}>{user.name}</Drawer.Trigger>
19
+ * {/each}
20
+ *
21
+ * <Drawer.Root handle={profile}>
22
+ * {#snippet children({ payload })}…{/snippet}
23
+ * </Drawer.Root>
24
+ * ```
25
+ */
26
+ export function createDrawerHandle() {
27
+ let isOpen = $state(false);
28
+ let payload = $state(undefined);
29
+ let trigger = $state(null);
30
+ return {
31
+ get isOpen() {
32
+ return isOpen;
33
+ },
34
+ get payload() {
35
+ return payload;
36
+ },
37
+ get trigger() {
38
+ return trigger;
39
+ },
40
+ open(nextPayload, nextTrigger) {
41
+ // The payload is only replaced when one is supplied, so an imperative
42
+ // `handle.open()` reopens with whatever the last trigger carried instead of
43
+ // blanking the drawer's contents.
44
+ if (nextPayload !== undefined)
45
+ payload = nextPayload;
46
+ if (nextTrigger !== undefined)
47
+ trigger = nextTrigger;
48
+ isOpen = true;
49
+ },
50
+ close() {
51
+ isOpen = false;
52
+ },
53
+ toggle(nextPayload, nextTrigger) {
54
+ if (isOpen) {
55
+ isOpen = false;
56
+ return;
57
+ }
58
+ this.open(nextPayload, nextTrigger);
59
+ },
60
+ setOpen(next) {
61
+ isOpen = next;
62
+ }
63
+ };
64
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Software-keyboard inset, published by `Drawer.VirtualKeyboardProvider`.
3
+ *
4
+ * It travels through context rather than a CSS variable on a wrapper element
5
+ * because the panel is portalled out of the provider's subtree, so nothing it
6
+ * writes on itself would ever cascade down to the drawer.
7
+ */
8
+ export type DrawerKeyboardContext = {
9
+ /** Height the keyboard covers, in px. `0` when it is closed. */
10
+ readonly inset: number;
11
+ };
12
+ export declare function setDrawerKeyboardContext(ctx: DrawerKeyboardContext): void;
13
+ export declare function getDrawerKeyboardContext(): DrawerKeyboardContext | undefined;
@@ -0,0 +1,8 @@
1
+ import { setContext, getContext } from 'svelte';
2
+ const DRAWER_KEYBOARD_KEY = Symbol('drawer-keyboard');
3
+ export function setDrawerKeyboardContext(ctx) {
4
+ setContext(DRAWER_KEYBOARD_KEY, ctx);
5
+ }
6
+ export function getDrawerKeyboardContext() {
7
+ return getContext(DRAWER_KEYBOARD_KEY);
8
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Presence state for the drawer's enter/exit animations.
3
+ *
4
+ * Provided by `Drawer.Portal` — which owns how long the layers stay mounted — and
5
+ * consumed by `Drawer.Overlay`, `Drawer.Viewport` and `Drawer.Content` for the
6
+ * `data-state` / `data-entering` / `data-exiting` hooks that CSS animates
7
+ * against. Content also registers its element so the Portal can measure the exit
8
+ * animation from it, which is what makes the timing follow the consumer's own CSS
9
+ * instead of a hard-coded duration.
10
+ */
11
+ export type DrawerPresenceContext = {
12
+ /** Logical state: 'open' while shown, 'closed' the moment it begins animating out. */
13
+ readonly state: 'open' | 'closed';
14
+ /** True for the duration of the enter animation. */
15
+ readonly isEntering: boolean;
16
+ /** True for the duration of the exit animation, before the node unmounts. */
17
+ readonly isExiting: boolean;
18
+ /** Content registers its element here so the Portal can time the exit off it. */
19
+ setMotionTarget: (el: HTMLElement | null) => void;
20
+ };
21
+ export declare function setDrawerPresenceContext(ctx: DrawerPresenceContext): void;
22
+ export declare function getDrawerPresenceContext(): DrawerPresenceContext | undefined;
@@ -0,0 +1,8 @@
1
+ import { setContext, getContext } from 'svelte';
2
+ const DRAWER_PRESENCE_KEY = Symbol('drawer-presence');
3
+ export function setDrawerPresenceContext(ctx) {
4
+ setContext(DRAWER_PRESENCE_KEY, ctx);
5
+ }
6
+ export function getDrawerPresenceContext() {
7
+ return getContext(DRAWER_PRESENCE_KEY);
8
+ }
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Snap point math for `Drawer.Root`.
3
+ *
4
+ * Kept free of the DOM so the interesting decisions — which point a flick lands
5
+ * on, when a release dismisses instead of snapping — can be tested directly
6
+ * instead of through a synthesised gesture.
7
+ *
8
+ * Two quantities are easy to confuse:
9
+ *
10
+ * - **size**: how much of the panel a snap point leaves visible along its axis.
11
+ * That is what the consumer writes (`0.5`, `'320px'`).
12
+ * - **offset**: how far the panel is translated OUT from fully open to leave that
13
+ * much visible — `panelSize - size`. That is what CSS consumes, through
14
+ * `--drawer-snap-point-offset`. Offsets grow as the drawer closes, matching the
15
+ * sign of a swipe, so a release can be resolved by comparing plain numbers.
16
+ */
17
+ import type { DrawerSnapPoint } from './types';
18
+ /**
19
+ * Visible extent, in px, that `point` asks for.
20
+ *
21
+ * - `0`–`1`: a fraction of the viewport along the axis.
22
+ * - above `1`: pixels.
23
+ * - a string: a CSS length (`'320px'`, `'30rem'`) or a percentage of the viewport.
24
+ *
25
+ * Returns `null` for anything unparseable, so a typo surfaces as a skipped snap
26
+ * point rather than a panel translated by `NaN`.
27
+ */
28
+ export declare function resolveSnapPointSize(point: DrawerSnapPoint, viewportSize: number, rootFontSize?: number): number | null;
29
+ /**
30
+ * Translation offsets for `points`, ascending — index 0 is the most open.
31
+ *
32
+ * Duplicates and unparseable entries are dropped, so the resulting array can be
33
+ * indexed safely but is not necessarily the same length as the input.
34
+ */
35
+ export declare function resolveSnapOffsets(points: readonly DrawerSnapPoint[], viewportSize: number, panelSize: number, rootFontSize?: number): number[];
36
+ /** Index of the snap point closest to `offset`, or `-1` when there are none. */
37
+ export declare function findNearestSnapIndex(offsets: readonly number[], offset: number): number;
38
+ export type SnapReleaseOptions = {
39
+ /** Outward offset, in px, where the finger let go. */
40
+ offset: number;
41
+ /** Release velocity in px/ms; positive means outward. */
42
+ velocity: number;
43
+ /** Snap offsets, ascending. */
44
+ offsets: readonly number[];
45
+ /** Index the drawer was resting at before the drag. */
46
+ currentIndex: number;
47
+ /** Panel extent along the axis, for the dismissal threshold. */
48
+ panelSize: number;
49
+ /** Restricts the release to the neighbouring snap points. */
50
+ sequential?: boolean;
51
+ /** Whether a release past the last snap point may close the drawer. */
52
+ dismissible?: boolean;
53
+ };
54
+ export type SnapRelease = {
55
+ /** Snap point to settle on. Meaningless when `dismiss` is true. */
56
+ index: number;
57
+ /** Whether the drawer should close instead of settling. */
58
+ dismiss: boolean;
59
+ };
60
+ /**
61
+ * Where a release should land.
62
+ *
63
+ * The decision is made on the PROJECTED resting position, not the position the
64
+ * finger left: a short flick means "go further", and snapping to whatever happened
65
+ * to be nearest at lift-off ignores that intent. `sequential` clamps the result to
66
+ * the neighbouring points for drawers where skipping ahead would be disorienting.
67
+ */
68
+ export declare function resolveSnapOnRelease(options: SnapReleaseOptions): SnapRelease;
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Snap point math for `Drawer.Root`.
3
+ *
4
+ * Kept free of the DOM so the interesting decisions — which point a flick lands
5
+ * on, when a release dismisses instead of snapping — can be tested directly
6
+ * instead of through a synthesised gesture.
7
+ *
8
+ * Two quantities are easy to confuse:
9
+ *
10
+ * - **size**: how much of the panel a snap point leaves visible along its axis.
11
+ * That is what the consumer writes (`0.5`, `'320px'`).
12
+ * - **offset**: how far the panel is translated OUT from fully open to leave that
13
+ * much visible — `panelSize - size`. That is what CSS consumes, through
14
+ * `--drawer-snap-point-offset`. Offsets grow as the drawer closes, matching the
15
+ * sign of a swipe, so a release can be resolved by comparing plain numbers.
16
+ */
17
+ import { projectRelease } from '../../primitives/swipe-gesture';
18
+ /**
19
+ * Visible extent, in px, that `point` asks for.
20
+ *
21
+ * - `0`–`1`: a fraction of the viewport along the axis.
22
+ * - above `1`: pixels.
23
+ * - a string: a CSS length (`'320px'`, `'30rem'`) or a percentage of the viewport.
24
+ *
25
+ * Returns `null` for anything unparseable, so a typo surfaces as a skipped snap
26
+ * point rather than a panel translated by `NaN`.
27
+ */
28
+ export function resolveSnapPointSize(point, viewportSize, rootFontSize = 16) {
29
+ if (typeof point === 'number') {
30
+ if (!Number.isFinite(point) || point < 0)
31
+ return null;
32
+ // The 0–1 fraction and the pixel range meet at 1, where "1px tall" is never
33
+ // what anyone means; it reads as "the whole viewport".
34
+ return point <= 1 ? point * viewportSize : point;
35
+ }
36
+ const text = point.trim();
37
+ const value = Number.parseFloat(text);
38
+ if (!Number.isFinite(value))
39
+ return null;
40
+ if (text.endsWith('%'))
41
+ return (value / 100) * viewportSize;
42
+ if (text.endsWith('rem'))
43
+ return value * rootFontSize;
44
+ if (text.endsWith('em'))
45
+ return value * rootFontSize;
46
+ if (text.endsWith('px'))
47
+ return value;
48
+ // A bare number inside a string behaves like the numeric form.
49
+ if (/^-?\d*\.?\d+$/.test(text))
50
+ return value <= 1 ? value * viewportSize : value;
51
+ return null;
52
+ }
53
+ /**
54
+ * Translation offsets for `points`, ascending — index 0 is the most open.
55
+ *
56
+ * Duplicates and unparseable entries are dropped, so the resulting array can be
57
+ * indexed safely but is not necessarily the same length as the input.
58
+ */
59
+ export function resolveSnapOffsets(points, viewportSize, panelSize, rootFontSize = 16) {
60
+ const offsets = [];
61
+ for (const point of points) {
62
+ const size = resolveSnapPointSize(point, viewportSize, rootFontSize);
63
+ if (size === null)
64
+ continue;
65
+ const offset = Math.max(0, panelSize - size);
66
+ if (!offsets.includes(offset))
67
+ offsets.push(offset);
68
+ }
69
+ return offsets.sort((a, b) => a - b);
70
+ }
71
+ /** Index of the snap point closest to `offset`, or `-1` when there are none. */
72
+ export function findNearestSnapIndex(offsets, offset) {
73
+ if (offsets.length === 0)
74
+ return -1;
75
+ let nearest = 0;
76
+ let smallest = Math.abs(offsets[0] - offset);
77
+ for (let index = 1; index < offsets.length; index += 1) {
78
+ const distance = Math.abs(offsets[index] - offset);
79
+ if (distance < smallest) {
80
+ smallest = distance;
81
+ nearest = index;
82
+ }
83
+ }
84
+ return nearest;
85
+ }
86
+ /** Fraction of the remaining travel past the last snap point that dismisses. */
87
+ const DISMISS_FRACTION = 0.5;
88
+ /** px/ms past which a release counts as a flick regardless of distance. */
89
+ const FLICK_VELOCITY = 0.4;
90
+ /**
91
+ * Where a release should land.
92
+ *
93
+ * The decision is made on the PROJECTED resting position, not the position the
94
+ * finger left: a short flick means "go further", and snapping to whatever happened
95
+ * to be nearest at lift-off ignores that intent. `sequential` clamps the result to
96
+ * the neighbouring points for drawers where skipping ahead would be disorienting.
97
+ */
98
+ export function resolveSnapOnRelease(options) {
99
+ const { offset, velocity, offsets, currentIndex, panelSize, sequential, dismissible } = options;
100
+ if (offsets.length === 0)
101
+ return { index: -1, dismiss: false };
102
+ const projected = projectRelease(offset, velocity);
103
+ const lastOffset = offsets[offsets.length - 1];
104
+ if (dismissible) {
105
+ const remaining = Math.max(0, panelSize - lastOffset);
106
+ const dismissThreshold = lastOffset + remaining * DISMISS_FRACTION;
107
+ const atLastPoint = currentIndex >= offsets.length - 1;
108
+ // A flick only dismisses from the most-closed point; from anywhere else it
109
+ // should still be able to fling the drawer down one step at a time.
110
+ if (projected >= dismissThreshold || (atLastPoint && velocity >= FLICK_VELOCITY)) {
111
+ return { index: offsets.length - 1, dismiss: true };
112
+ }
113
+ }
114
+ const nearest = findNearestSnapIndex(offsets, projected);
115
+ if (!sequential)
116
+ return { index: nearest, dismiss: false };
117
+ const lowerBound = Math.max(0, currentIndex - 1);
118
+ const upperBound = Math.min(offsets.length - 1, currentIndex + 1);
119
+ return { index: Math.min(Math.max(nearest, lowerBound), upperBound), dismiss: false };
120
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * "Starting style" flag for enter transitions.
3
+ *
4
+ * A CSS transition needs two values to interpolate between, and a node inserted
5
+ * straight into its final state never gets the first one — it simply appears.
6
+ * Keyframe animations do not have this problem, which is why the rest of the
7
+ * library gets away without it; a drawer animates with a `translate` transition,
8
+ * so it does.
9
+ *
10
+ * The flag is `true` for the first painted frame, letting CSS say where the panel
11
+ * comes FROM, and drops on the next frame so the transition runs. It has to start
12
+ * `true` rather than being set in an effect: the attribute must already be in the
13
+ * markup Svelte inserts, or the browser's first paint has the final value and
14
+ * there is nothing to animate away from.
15
+ */
16
+ export declare function createStartingStyle(): {
17
+ readonly active: boolean;
18
+ };
@@ -0,0 +1,38 @@
1
+ /**
2
+ * "Starting style" flag for enter transitions.
3
+ *
4
+ * A CSS transition needs two values to interpolate between, and a node inserted
5
+ * straight into its final state never gets the first one — it simply appears.
6
+ * Keyframe animations do not have this problem, which is why the rest of the
7
+ * library gets away without it; a drawer animates with a `translate` transition,
8
+ * so it does.
9
+ *
10
+ * The flag is `true` for the first painted frame, letting CSS say where the panel
11
+ * comes FROM, and drops on the next frame so the transition runs. It has to start
12
+ * `true` rather than being set in an effect: the attribute must already be in the
13
+ * markup Svelte inserts, or the browser's first paint has the final value and
14
+ * there is nothing to animate away from.
15
+ */
16
+ export function createStartingStyle() {
17
+ let active = $state(true);
18
+ $effect(() => {
19
+ // Two frames, not one: the first fires BEFORE the paint that shows the
20
+ // starting position, so clearing there would collapse the transition.
21
+ let inner;
22
+ const outer = requestAnimationFrame(() => {
23
+ inner = requestAnimationFrame(() => {
24
+ active = false;
25
+ });
26
+ });
27
+ return () => {
28
+ cancelAnimationFrame(outer);
29
+ if (inner !== undefined)
30
+ cancelAnimationFrame(inner);
31
+ };
32
+ });
33
+ return {
34
+ get active() {
35
+ return active;
36
+ }
37
+ };
38
+ }
@@ -0,0 +1,36 @@
1
+ /** Edge the drawer is anchored to. Also sets the axis it travels along. */
2
+ export type DrawerSide = 'top' | 'right' | 'bottom' | 'left';
3
+ /**
4
+ * How much of the page the drawer takes over.
5
+ *
6
+ * - `true` — focus is trapped, the background is hidden from assistive tech, and
7
+ * page scrolling is locked.
8
+ * - `'trap-focus'` — focus is trapped, but the page keeps scrolling and stays
9
+ * readable. For a persistent panel that still owns the keyboard.
10
+ * - `false` — none of the above; the drawer is a floating panel the rest of the
11
+ * page keeps working around it.
12
+ */
13
+ export type DrawerModal = boolean | 'trap-focus';
14
+ export type DrawerCloseReason = 'escape-key' | 'outside-press' | 'swipe' | 'imperative-action' | 'none';
15
+ /**
16
+ * A resting position for the panel.
17
+ *
18
+ * - `0` to `1` — a fraction of the viewport along the drawer's axis.
19
+ * - a number above `1` — pixels.
20
+ * - a string — any CSS length or percentage (`'148px'`, `'30rem'`, `'50%'`),
21
+ * resolved against the viewport.
22
+ */
23
+ export type DrawerSnapPoint = number | string;
24
+ /** Helper object passed to the `children` snippet of `Drawer.Root`. */
25
+ export type DrawerStateHelpers<Payload = unknown> = {
26
+ /** Close the drawer. */
27
+ close: () => void;
28
+ /** Open the drawer. */
29
+ open: () => void;
30
+ /** Toggle the open state. */
31
+ toggle: () => void;
32
+ /** Whether the drawer is currently open. */
33
+ isOpen: boolean;
34
+ /** Value carried by the trigger that opened it, when using a detached handle. */
35
+ payload: Payload | undefined;
36
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare function markDrawerViewport(): void;
2
+ export declare function hasDrawerViewport(): boolean;
@@ -0,0 +1,16 @@
1
+ import { setContext, getContext } from 'svelte';
2
+ /**
3
+ * Marks that a `Drawer.Viewport` is present.
4
+ *
5
+ * `Drawer.Content` positions itself against its edge when no viewport wraps it, so
6
+ * the simple `Portal → Overlay + Content` composition works without a positioning
7
+ * layer. Inside a viewport it stays in flow and lets the viewport's flexbox place
8
+ * it, which is what makes cross-axis alignment and nested stacking possible.
9
+ */
10
+ const DRAWER_VIEWPORT_KEY = Symbol('drawer-viewport');
11
+ export function markDrawerViewport() {
12
+ setContext(DRAWER_VIEWPORT_KEY, true);
13
+ }
14
+ export function hasDrawerViewport() {
15
+ return getContext(DRAWER_VIEWPORT_KEY) === true;
16
+ }
@@ -0,0 +1,143 @@
1
+ <script lang="ts">
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import {
4
+ swipeGesture,
5
+ getSwipeAxis,
6
+ type SwipeGestureOptions
7
+ } from '../../primitives/swipe-gesture';
8
+ import { getFloatingLayerZIndex } from '../../primitives/layer-stack';
9
+ import { requireDrawerContext } from '../root/context';
10
+ import type { DrawerSide } from '../root/types';
11
+
12
+ /**
13
+ * Drawer.SwipeArea — an invisible strip along the viewport edge that opens the
14
+ * drawer when dragged inward.
15
+ *
16
+ * Render it outside `Drawer.Portal`: it has to exist while the drawer is closed,
17
+ * and the portal only mounts once it opens.
18
+ *
19
+ * A swipe is never the only way in — pair this with a `Drawer.Trigger`, or the
20
+ * drawer is unreachable by keyboard and to anyone who cannot perform the gesture.
21
+ */
22
+ type DrawerSwipeAreaProps = {
23
+ /** The CSS class names of the strip. */
24
+ class?: string;
25
+ /** The thickness of the strip, as a CSS length. */
26
+ size?: string;
27
+ /** Stops the gesture, but keeps the strip in the DOM. */
28
+ disabled?: boolean;
29
+ } & Omit<HTMLAttributes<HTMLDivElement>, 'class'>;
30
+
31
+ let {
32
+ class: className = '',
33
+ size = '24px',
34
+ disabled = false,
35
+ style: styleProp,
36
+ ...restProps
37
+ }: DrawerSwipeAreaProps = $props();
38
+
39
+ const ctx = requireDrawerContext('Drawer.SwipeArea');
40
+
41
+ /** Fraction of the panel the drag must cover for the drawer to stay open. */
42
+ const OPEN_FRACTION = 0.4;
43
+ /** px/ms past which a flick opens regardless of distance. */
44
+ const FLICK_VELOCITY = 0.4;
45
+
46
+ // The gesture's "outward" is the direction a panel LEAVES by, and opening runs the
47
+ // other way — so it is configured against the opposite side and its positive
48
+ // displacement is the distance pulled in.
49
+ function opposite(side: DrawerSide): DrawerSide {
50
+ if (side === 'bottom') return 'top';
51
+ if (side === 'top') return 'bottom';
52
+ if (side === 'left') return 'right';
53
+ return 'left';
54
+ }
55
+
56
+ const gestureSide = $derived(opposite(ctx.side));
57
+ const axis = $derived(getSwipeAxis(ctx.side));
58
+
59
+ let isSwiping = $state(false);
60
+
61
+ function handleStart() {
62
+ isSwiping = true;
63
+ // Open immediately so the panel mounts and can start following the finger; the
64
+ // release decides whether it stays.
65
+ ctx.setSwipeOpenDistance(0);
66
+ ctx.open();
67
+ }
68
+
69
+ function handleMove(displacement: number) {
70
+ ctx.setSwipeOpenDistance(Math.max(0, displacement));
71
+ }
72
+
73
+ function handleEnd(displacement: number, velocity: number, event: PointerEvent) {
74
+ isSwiping = false;
75
+ ctx.setSwipeOpenDistance(null);
76
+
77
+ const extent = ctx.panelExtent;
78
+ const farEnough = extent > 0 && displacement >= extent * OPEN_FRACTION;
79
+ if (farEnough || velocity >= FLICK_VELOCITY) return;
80
+
81
+ ctx.close('swipe', event);
82
+ }
83
+
84
+ function handleCancel() {
85
+ isSwiping = false;
86
+ ctx.setSwipeOpenDistance(null);
87
+ ctx.close('swipe');
88
+ }
89
+
90
+ const swipeOptions = $derived<SwipeGestureOptions>({
91
+ // `|| isSwiping` keeps the gesture alive through the open it just caused.
92
+ // Without it the drawer opening flips `enabled` to false, the action tears the
93
+ // in-flight drag down, and the release that decides whether to keep the drawer
94
+ // open never arrives — so a half-hearted swipe left it open.
95
+ enabled: !disabled && (!ctx.isOpen || isSwiping),
96
+ side: gestureSide,
97
+ // The strip is a dedicated gesture surface with nothing to scroll, so the axis
98
+ // can be reserved outright — unlike the panel, where doing so would break every
99
+ // scrollable region inside it.
100
+ touchAction: 'none',
101
+ onStart: handleStart,
102
+ onMove: ({ displacement }) => handleMove(displacement),
103
+ onEnd: ({ displacement, velocity, event }) => handleEnd(displacement, velocity, event),
104
+ onCancel: handleCancel
105
+ });
106
+
107
+ function edgeFor(side: DrawerSide): string {
108
+ if (side === 'top') return `top: 0; left: 0; right: 0; height: ${size};`;
109
+ if (side === 'bottom') return `bottom: 0; left: 0; right: 0; height: ${size};`;
110
+ if (side === 'left') return `left: 0; top: 0; bottom: 0; width: ${size};`;
111
+ return `right: 0; top: 0; bottom: 0; width: ${size};`;
112
+ }
113
+
114
+ /** Direction the finger travels to open, for `data-swipe-direction`. */
115
+ function directionFor(side: DrawerSide): 'up' | 'down' | 'left' | 'right' {
116
+ if (side === 'bottom') return 'up';
117
+ if (side === 'top') return 'down';
118
+ if (side === 'left') return 'right';
119
+ return 'left';
120
+ }
121
+
122
+ // Below the drawer's own layers so an open panel is never blocked by the strip,
123
+ // above ordinary page content so the gesture is reachable.
124
+ const style = $derived(
125
+ `position: fixed; ${edgeFor(ctx.side)} z-index: ${getFloatingLayerZIndex() - 2}; ${
126
+ ctx.isOpen ? 'pointer-events: none;' : ''
127
+ } ${styleProp ?? ''}`
128
+ );
129
+ </script>
130
+
131
+ <div
132
+ class={className}
133
+ data-drawer-swipe-area
134
+ data-state={ctx.isOpen ? 'open' : 'closed'}
135
+ data-disabled={disabled || undefined}
136
+ data-swiping={isSwiping || undefined}
137
+ data-swipe-direction={directionFor(ctx.side)}
138
+ data-axis={axis}
139
+ aria-hidden="true"
140
+ {style}
141
+ use:swipeGesture={swipeOptions}
142
+ {...restProps}
143
+ ></div>
@@ -0,0 +1,22 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ /**
3
+ * Drawer.SwipeArea — an invisible strip along the viewport edge that opens the
4
+ * drawer when dragged inward.
5
+ *
6
+ * Render it outside `Drawer.Portal`: it has to exist while the drawer is closed,
7
+ * and the portal only mounts once it opens.
8
+ *
9
+ * A swipe is never the only way in — pair this with a `Drawer.Trigger`, or the
10
+ * drawer is unreachable by keyboard and to anyone who cannot perform the gesture.
11
+ */
12
+ type DrawerSwipeAreaProps = {
13
+ /** The CSS class names of the strip. */
14
+ class?: string;
15
+ /** The thickness of the strip, as a CSS length. */
16
+ size?: string;
17
+ /** Stops the gesture, but keeps the strip in the DOM. */
18
+ disabled?: boolean;
19
+ } & Omit<HTMLAttributes<HTMLDivElement>, 'class'>;
20
+ declare const DrawerSwipeArea: import("svelte").Component<DrawerSwipeAreaProps, {}, "">;
21
+ type DrawerSwipeArea = ReturnType<typeof DrawerSwipeArea>;
22
+ export default DrawerSwipeArea;
@@ -0,0 +1,37 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import type { HTMLAttributes } from 'svelte/elements';
4
+ import { requireDrawerContext } from '../root/context';
5
+
6
+ /**
7
+ * Drawer.Title — the panel's accessible name.
8
+ *
9
+ * Registers its id with the root, which hands it to `Drawer.Content` as
10
+ * `aria-labelledby`. Writing a bare heading instead leaves the drawer unnamed:
11
+ * a `role="dialog"` takes its name from `aria-labelledby`/`aria-label`, never
12
+ * from the text inside it.
13
+ */
14
+ type DrawerTitleProps = {
15
+ /** The name of the drawer. */
16
+ children?: Snippet;
17
+ /** The CSS class names of the heading. */
18
+ class?: string;
19
+ /** Replaces the id that the component makes. */
20
+ id?: string;
21
+ } & Omit<HTMLAttributes<HTMLHeadingElement>, 'class' | 'children' | 'id'>;
22
+
23
+ let { children, class: className = '', id: idProp, ...restProps }: DrawerTitleProps = $props();
24
+
25
+ const ctx = requireDrawerContext('Drawer.Title');
26
+ const generatedId = $props.id();
27
+ const id = $derived(idProp ?? generatedId);
28
+
29
+ // The returned unregister runs on destroy, and again whenever the id changes.
30
+ $effect(() => ctx.registerLabel(id));
31
+ </script>
32
+
33
+ <h2 {id} class={className} data-drawer-title {...restProps}>
34
+ {#if children}
35
+ {@render children()}
36
+ {/if}
37
+ </h2>
@@ -0,0 +1,21 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ /**
4
+ * Drawer.Title — the panel's accessible name.
5
+ *
6
+ * Registers its id with the root, which hands it to `Drawer.Content` as
7
+ * `aria-labelledby`. Writing a bare heading instead leaves the drawer unnamed:
8
+ * a `role="dialog"` takes its name from `aria-labelledby`/`aria-label`, never
9
+ * from the text inside it.
10
+ */
11
+ type DrawerTitleProps = {
12
+ /** The name of the drawer. */
13
+ children?: Snippet;
14
+ /** The CSS class names of the heading. */
15
+ class?: string;
16
+ /** Replaces the id that the component makes. */
17
+ id?: string;
18
+ } & Omit<HTMLAttributes<HTMLHeadingElement>, 'class' | 'children' | 'id'>;
19
+ declare const DrawerTitle: import("svelte").Component<DrawerTitleProps, {}, "">;
20
+ type DrawerTitle = ReturnType<typeof DrawerTitle>;
21
+ export default DrawerTitle;