@bevelo/svelte 0.0.0-stage → 0.1.0

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 (409) hide show
  1. package/LICENSE +21 -0
  2. package/dist/accordion.svelte +98 -0
  3. package/dist/accordion.svelte.d.ts +29 -0
  4. package/dist/agent.d.ts +2 -0
  5. package/dist/agent.js +5 -0
  6. package/dist/alert-dialog.svelte +17 -0
  7. package/dist/alert-dialog.svelte.d.ts +7 -0
  8. package/dist/alert.svelte +78 -0
  9. package/dist/alert.svelte.d.ts +16 -0
  10. package/dist/aspect-ratio.svelte +43 -0
  11. package/dist/aspect-ratio.svelte.d.ts +12 -0
  12. package/dist/async-options.svelte.d.ts +42 -0
  13. package/dist/async-options.svelte.js +94 -0
  14. package/dist/autocomplete.svelte +332 -0
  15. package/dist/autocomplete.svelte.d.ts +81 -0
  16. package/dist/avatar.svelte +39 -0
  17. package/dist/avatar.svelte.d.ts +12 -0
  18. package/dist/badge.svelte +37 -0
  19. package/dist/badge.svelte.d.ts +12 -0
  20. package/dist/bound.svelte.d.ts +15 -0
  21. package/dist/bound.svelte.js +56 -0
  22. package/dist/breadcrumb.svelte +90 -0
  23. package/dist/breadcrumb.svelte.d.ts +22 -0
  24. package/dist/button.svelte +45 -0
  25. package/dist/button.svelte.d.ts +12 -0
  26. package/dist/calendar.svelte +463 -0
  27. package/dist/calendar.svelte.d.ts +74 -0
  28. package/dist/card.svelte +69 -0
  29. package/dist/card.svelte.d.ts +16 -0
  30. package/dist/carousel.svelte +262 -0
  31. package/dist/carousel.svelte.d.ts +45 -0
  32. package/dist/checkbox-group-scope.d.ts +11 -0
  33. package/dist/checkbox-group-scope.js +5 -0
  34. package/dist/checkbox-group.svelte +93 -0
  35. package/dist/checkbox-group.svelte.d.ts +18 -0
  36. package/dist/checkbox.svelte +89 -0
  37. package/dist/checkbox.svelte.d.ts +16 -0
  38. package/dist/collapsible.svelte +73 -0
  39. package/dist/collapsible.svelte.d.ts +25 -0
  40. package/dist/color-picker-alpha-thumb.svelte +11 -0
  41. package/dist/color-picker-alpha-thumb.svelte.d.ts +4 -0
  42. package/dist/color-picker-area-canvas.svelte +11 -0
  43. package/dist/color-picker-area-canvas.svelte.d.ts +4 -0
  44. package/dist/color-picker-area-thumb.svelte +11 -0
  45. package/dist/color-picker-area-thumb.svelte.d.ts +4 -0
  46. package/dist/color-picker-area.svelte +11 -0
  47. package/dist/color-picker-area.svelte.d.ts +4 -0
  48. package/dist/color-picker-channel-input.svelte +35 -0
  49. package/dist/color-picker-channel-input.svelte.d.ts +9 -0
  50. package/dist/color-picker-context.d.ts +23 -0
  51. package/dist/color-picker-context.js +24 -0
  52. package/dist/color-picker-eye-dropper.svelte +11 -0
  53. package/dist/color-picker-eye-dropper.svelte.d.ts +4 -0
  54. package/dist/color-picker-input.svelte +11 -0
  55. package/dist/color-picker-input.svelte.d.ts +4 -0
  56. package/dist/color-picker-part.svelte +38 -0
  57. package/dist/color-picker-part.svelte.d.ts +11 -0
  58. package/dist/color-picker-slider-thumb.svelte +11 -0
  59. package/dist/color-picker-slider-thumb.svelte.d.ts +4 -0
  60. package/dist/color-picker-slider.svelte +21 -0
  61. package/dist/color-picker-slider.svelte.d.ts +9 -0
  62. package/dist/color-picker-swatch-item.svelte +38 -0
  63. package/dist/color-picker-swatch-item.svelte.d.ts +9 -0
  64. package/dist/color-picker-swatch.svelte +11 -0
  65. package/dist/color-picker-swatch.svelte.d.ts +4 -0
  66. package/dist/color-picker-swatches.svelte +11 -0
  67. package/dist/color-picker-swatches.svelte.d.ts +4 -0
  68. package/dist/color-picker.svelte +132 -0
  69. package/dist/color-picker.svelte.d.ts +18 -0
  70. package/dist/combobox-chip-remove.svelte +25 -0
  71. package/dist/combobox-chip-remove.svelte.d.ts +4 -0
  72. package/dist/combobox-chip.svelte +14 -0
  73. package/dist/combobox-chip.svelte.d.ts +7 -0
  74. package/dist/combobox-chips-overflow.svelte +27 -0
  75. package/dist/combobox-chips-overflow.svelte.d.ts +12 -0
  76. package/dist/combobox-chips.svelte +12 -0
  77. package/dist/combobox-chips.svelte.d.ts +4 -0
  78. package/dist/combobox-clear.svelte +27 -0
  79. package/dist/combobox-clear.svelte.d.ts +4 -0
  80. package/dist/combobox-compound-root.svelte +150 -0
  81. package/dist/combobox-compound-root.svelte.d.ts +37 -0
  82. package/dist/combobox-compound.svelte.d.ts +59 -0
  83. package/dist/combobox-compound.svelte.js +21 -0
  84. package/dist/combobox-content.svelte +21 -0
  85. package/dist/combobox-content.svelte.d.ts +7 -0
  86. package/dist/combobox-create.svelte +63 -0
  87. package/dist/combobox-create.svelte.d.ts +11 -0
  88. package/dist/combobox-empty.svelte +22 -0
  89. package/dist/combobox-empty.svelte.d.ts +9 -0
  90. package/dist/combobox-group-label.svelte +14 -0
  91. package/dist/combobox-group-label.svelte.d.ts +4 -0
  92. package/dist/combobox-group.svelte +16 -0
  93. package/dist/combobox-group.svelte.d.ts +4 -0
  94. package/dist/combobox-input.svelte +44 -0
  95. package/dist/combobox-input.svelte.d.ts +4 -0
  96. package/dist/combobox-item-icon.svelte +12 -0
  97. package/dist/combobox-item-icon.svelte.d.ts +7 -0
  98. package/dist/combobox-item-indicator.svelte +24 -0
  99. package/dist/combobox-item-indicator.svelte.d.ts +7 -0
  100. package/dist/combobox-item-text.svelte +31 -0
  101. package/dist/combobox-item-text.svelte.d.ts +11 -0
  102. package/dist/combobox-item.svelte +87 -0
  103. package/dist/combobox-item.svelte.d.ts +14 -0
  104. package/dist/combobox-label.svelte +14 -0
  105. package/dist/combobox-label.svelte.d.ts +4 -0
  106. package/dist/combobox-list.svelte +36 -0
  107. package/dist/combobox-list.svelte.d.ts +12 -0
  108. package/dist/combobox-options.svelte +194 -0
  109. package/dist/combobox-options.svelte.d.ts +63 -0
  110. package/dist/combobox-select-all.svelte +36 -0
  111. package/dist/combobox-select-all.svelte.d.ts +11 -0
  112. package/dist/combobox-separator.svelte +12 -0
  113. package/dist/combobox-separator.svelte.d.ts +4 -0
  114. package/dist/combobox-status.svelte +20 -0
  115. package/dist/combobox-status.svelte.d.ts +9 -0
  116. package/dist/combobox-trigger.svelte +36 -0
  117. package/dist/combobox-trigger.svelte.d.ts +11 -0
  118. package/dist/combobox-value-icon.svelte +12 -0
  119. package/dist/combobox-value-icon.svelte.d.ts +4 -0
  120. package/dist/combobox-value.svelte +40 -0
  121. package/dist/combobox-value.svelte.d.ts +12 -0
  122. package/dist/combobox.svelte +59 -0
  123. package/dist/combobox.svelte.d.ts +37 -0
  124. package/dist/command-empty.svelte +29 -0
  125. package/dist/command-empty.svelte.d.ts +15 -0
  126. package/dist/command-group-label.svelte +16 -0
  127. package/dist/command-group-label.svelte.d.ts +9 -0
  128. package/dist/command-group.svelte +31 -0
  129. package/dist/command-group.svelte.d.ts +11 -0
  130. package/dist/command-inline.svelte +45 -0
  131. package/dist/command-inline.svelte.d.ts +14 -0
  132. package/dist/command-input.svelte +27 -0
  133. package/dist/command-input.svelte.d.ts +6 -0
  134. package/dist/command-item-icon.svelte +18 -0
  135. package/dist/command-item-icon.svelte.d.ts +11 -0
  136. package/dist/command-item-text.svelte +24 -0
  137. package/dist/command-item-text.svelte.d.ts +12 -0
  138. package/dist/command-item.svelte +110 -0
  139. package/dist/command-item.svelte.d.ts +22 -0
  140. package/dist/command-list.svelte +28 -0
  141. package/dist/command-list.svelte.d.ts +15 -0
  142. package/dist/command-page.svelte +24 -0
  143. package/dist/command-page.svelte.d.ts +13 -0
  144. package/dist/command-scope.svelte.d.ts +93 -0
  145. package/dist/command-scope.svelte.js +155 -0
  146. package/dist/command-separator.svelte +13 -0
  147. package/dist/command-separator.svelte.d.ts +6 -0
  148. package/dist/command-shortcut.svelte +20 -0
  149. package/dist/command-shortcut.svelte.d.ts +11 -0
  150. package/dist/command-status.svelte +21 -0
  151. package/dist/command-status.svelte.d.ts +10 -0
  152. package/dist/command.svelte +219 -0
  153. package/dist/command.svelte.d.ts +54 -0
  154. package/dist/context-menu.svelte +107 -0
  155. package/dist/context-menu.svelte.d.ts +15 -0
  156. package/dist/date-input-segment.svelte +50 -0
  157. package/dist/date-input-segment.svelte.d.ts +12 -0
  158. package/dist/date-input.svelte +245 -0
  159. package/dist/date-input.svelte.d.ts +37 -0
  160. package/dist/date-picker.svelte +533 -0
  161. package/dist/date-picker.svelte.d.ts +85 -0
  162. package/dist/date-segments-context.d.ts +7 -0
  163. package/dist/date-segments-context.js +7 -0
  164. package/dist/describe.svelte +41 -0
  165. package/dist/describe.svelte.d.ts +8 -0
  166. package/dist/dialog.svelte +91 -0
  167. package/dist/dialog.svelte.d.ts +17 -0
  168. package/dist/direction.svelte +43 -0
  169. package/dist/direction.svelte.d.ts +12 -0
  170. package/dist/dnd.svelte.d.ts +60 -0
  171. package/dist/dnd.svelte.js +101 -0
  172. package/dist/drawer.svelte +87 -0
  173. package/dist/drawer.svelte.d.ts +17 -0
  174. package/dist/empty-state.svelte +83 -0
  175. package/dist/empty-state.svelte.d.ts +16 -0
  176. package/dist/engine-state.svelte.d.ts +12 -0
  177. package/dist/engine-state.svelte.js +28 -0
  178. package/dist/error-state.svelte +93 -0
  179. package/dist/error-state.svelte.d.ts +16 -0
  180. package/dist/field-api.d.ts +6 -0
  181. package/dist/field-api.js +16 -0
  182. package/dist/field.svelte +143 -0
  183. package/dist/field.svelte.d.ts +37 -0
  184. package/dist/file-input.svelte +102 -0
  185. package/dist/file-input.svelte.d.ts +28 -0
  186. package/dist/gauge-context.d.ts +26 -0
  187. package/dist/gauge-context.js +41 -0
  188. package/dist/gauge-indicator.svelte +25 -0
  189. package/dist/gauge-indicator.svelte.d.ts +10 -0
  190. package/dist/gauge-label.svelte +16 -0
  191. package/dist/gauge-label.svelte.d.ts +8 -0
  192. package/dist/gauge-track.svelte +14 -0
  193. package/dist/gauge-track.svelte.d.ts +8 -0
  194. package/dist/gauge-value.svelte +14 -0
  195. package/dist/gauge-value.svelte.d.ts +9 -0
  196. package/dist/headless.svelte.d.ts +63 -0
  197. package/dist/headless.svelte.js +314 -0
  198. package/dist/hidden-input.svelte +42 -0
  199. package/dist/hidden-input.svelte.d.ts +12 -0
  200. package/dist/hover-card.svelte +69 -0
  201. package/dist/hover-card.svelte.d.ts +17 -0
  202. package/dist/icon-button.svelte +83 -0
  203. package/dist/icon-button.svelte.d.ts +12 -0
  204. package/dist/icon.svelte +41 -0
  205. package/dist/icon.svelte.d.ts +16 -0
  206. package/dist/image-cropper.svelte +78 -0
  207. package/dist/image-cropper.svelte.d.ts +8 -0
  208. package/dist/image.svelte +51 -0
  209. package/dist/image.svelte.d.ts +12 -0
  210. package/dist/index.d.ts +198 -0
  211. package/dist/index.js +187 -0
  212. package/dist/input-group.svelte +100 -0
  213. package/dist/input-group.svelte.d.ts +14 -0
  214. package/dist/input.svelte +63 -0
  215. package/dist/input.svelte.d.ts +17 -0
  216. package/dist/item.svelte +147 -0
  217. package/dist/item.svelte.d.ts +29 -0
  218. package/dist/kbd.svelte +41 -0
  219. package/dist/kbd.svelte.d.ts +12 -0
  220. package/dist/label.svelte +40 -0
  221. package/dist/label.svelte.d.ts +14 -0
  222. package/dist/listbox.svelte +135 -0
  223. package/dist/listbox.svelte.d.ts +38 -0
  224. package/dist/loader.svelte +38 -0
  225. package/dist/loader.svelte.d.ts +8 -0
  226. package/dist/mention-menu.svelte +134 -0
  227. package/dist/mention-menu.svelte.d.ts +23 -0
  228. package/dist/menu.svelte +185 -0
  229. package/dist/menu.svelte.d.ts +34 -0
  230. package/dist/menubar.svelte +75 -0
  231. package/dist/menubar.svelte.d.ts +21 -0
  232. package/dist/meter.svelte +83 -0
  233. package/dist/meter.svelte.d.ts +21 -0
  234. package/dist/native-select.svelte +87 -0
  235. package/dist/native-select.svelte.d.ts +16 -0
  236. package/dist/navigation-menu.svelte +155 -0
  237. package/dist/navigation-menu.svelte.d.ts +28 -0
  238. package/dist/number-input-scrub-area.svelte +55 -0
  239. package/dist/number-input-scrub-area.svelte.d.ts +18 -0
  240. package/dist/number-input-scrub.d.ts +6 -0
  241. package/dist/number-input-scrub.js +4 -0
  242. package/dist/number-input.svelte +86 -0
  243. package/dist/number-input.svelte.d.ts +26 -0
  244. package/dist/otp-input.svelte +96 -0
  245. package/dist/otp-input.svelte.d.ts +14 -0
  246. package/dist/overlay.svelte.d.ts +29 -0
  247. package/dist/overlay.svelte.js +46 -0
  248. package/dist/pagination.svelte +129 -0
  249. package/dist/pagination.svelte.d.ts +33 -0
  250. package/dist/parts-part.svelte +62 -0
  251. package/dist/parts-part.svelte.d.ts +14 -0
  252. package/dist/parts-root.svelte +74 -0
  253. package/dist/parts-root.svelte.d.ts +12 -0
  254. package/dist/password-input.svelte +129 -0
  255. package/dist/password-input.svelte.d.ts +49 -0
  256. package/dist/popover.svelte +85 -0
  257. package/dist/popover.svelte.d.ts +19 -0
  258. package/dist/preferences/preferences.svelte +96 -0
  259. package/dist/preferences/preferences.svelte.d.ts +21 -0
  260. package/dist/preferences.d.ts +2 -0
  261. package/dist/preferences.js +2 -0
  262. package/dist/preferences.svelte.d.ts +11 -0
  263. package/dist/preferences.svelte.js +26 -0
  264. package/dist/presence.svelte.d.ts +25 -0
  265. package/dist/presence.svelte.js +57 -0
  266. package/dist/progress.svelte +88 -0
  267. package/dist/progress.svelte.d.ts +21 -0
  268. package/dist/props.d.ts +8 -0
  269. package/dist/props.js +7 -0
  270. package/dist/query.svelte.d.ts +65 -0
  271. package/dist/query.svelte.js +219 -0
  272. package/dist/radio.svelte +79 -0
  273. package/dist/radio.svelte.d.ts +21 -0
  274. package/dist/rating.svelte +86 -0
  275. package/dist/rating.svelte.d.ts +28 -0
  276. package/dist/resizable.svelte +69 -0
  277. package/dist/resizable.svelte.d.ts +21 -0
  278. package/dist/scroll-area.svelte +66 -0
  279. package/dist/scroll-area.svelte.d.ts +18 -0
  280. package/dist/segmented-control.svelte +83 -0
  281. package/dist/segmented-control.svelte.d.ts +27 -0
  282. package/dist/select.svelte +285 -0
  283. package/dist/select.svelte.d.ts +77 -0
  284. package/dist/separator.svelte +26 -0
  285. package/dist/separator.svelte.d.ts +8 -0
  286. package/dist/sheet.svelte +105 -0
  287. package/dist/sheet.svelte.d.ts +19 -0
  288. package/dist/sidebar.svelte +66 -0
  289. package/dist/sidebar.svelte.d.ts +16 -0
  290. package/dist/skeleton.svelte +29 -0
  291. package/dist/skeleton.svelte.d.ts +8 -0
  292. package/dist/slider.svelte +78 -0
  293. package/dist/slider.svelte.d.ts +17 -0
  294. package/dist/sortable-board-strict.svelte +76 -0
  295. package/dist/sortable-board-strict.svelte.d.ts +12 -0
  296. package/dist/sortable-engine.svelte +129 -0
  297. package/dist/sortable-engine.svelte.d.ts +30 -0
  298. package/dist/sortable.svelte +86 -0
  299. package/dist/sortable.svelte.d.ts +27 -0
  300. package/dist/spinner.svelte +27 -0
  301. package/dist/spinner.svelte.d.ts +8 -0
  302. package/dist/steps.svelte +95 -0
  303. package/dist/steps.svelte.d.ts +23 -0
  304. package/dist/switch.svelte +74 -0
  305. package/dist/switch.svelte.d.ts +19 -0
  306. package/dist/table.svelte +151 -0
  307. package/dist/table.svelte.d.ts +23 -0
  308. package/dist/tabs.svelte +97 -0
  309. package/dist/tabs.svelte.d.ts +23 -0
  310. package/dist/textarea.svelte +65 -0
  311. package/dist/textarea.svelte.d.ts +17 -0
  312. package/dist/time-input.svelte +128 -0
  313. package/dist/time-input.svelte.d.ts +28 -0
  314. package/dist/timeline.svelte +88 -0
  315. package/dist/timeline.svelte.d.ts +25 -0
  316. package/dist/toast.svelte +190 -0
  317. package/dist/toast.svelte.d.ts +37 -0
  318. package/dist/toaster.d.ts +2 -0
  319. package/dist/toaster.js +6 -0
  320. package/dist/toggle-group.svelte +76 -0
  321. package/dist/toggle-group.svelte.d.ts +19 -0
  322. package/dist/toggle.svelte +50 -0
  323. package/dist/toggle.svelte.d.ts +14 -0
  324. package/dist/token-input-editor.svelte +42 -0
  325. package/dist/token-input-editor.svelte.d.ts +4 -0
  326. package/dist/token-input-segments-root.svelte +120 -0
  327. package/dist/token-input-segments-root.svelte.d.ts +33 -0
  328. package/dist/token-input-token-remove.svelte +32 -0
  329. package/dist/token-input-token-remove.svelte.d.ts +4 -0
  330. package/dist/token-input-token-scope.svelte +15 -0
  331. package/dist/token-input-token-scope.svelte.d.ts +9 -0
  332. package/dist/token-input-token.svelte +22 -0
  333. package/dist/token-input-token.svelte.d.ts +4 -0
  334. package/dist/token-input.svelte +157 -0
  335. package/dist/token-input.svelte.d.ts +66 -0
  336. package/dist/token-segments-scope.svelte.d.ts +17 -0
  337. package/dist/token-segments-scope.svelte.js +11 -0
  338. package/dist/toolbar-item.svelte +31 -0
  339. package/dist/toolbar-item.svelte.d.ts +14 -0
  340. package/dist/toolbar.svelte +74 -0
  341. package/dist/toolbar.svelte.d.ts +19 -0
  342. package/dist/tooltip.svelte +84 -0
  343. package/dist/tooltip.svelte.d.ts +18 -0
  344. package/dist/tree-grid.svelte +159 -0
  345. package/dist/tree-grid.svelte.d.ts +34 -0
  346. package/dist/tree.svelte +229 -0
  347. package/dist/tree.svelte.d.ts +65 -0
  348. package/dist/trigger-menu-content.svelte +24 -0
  349. package/dist/trigger-menu-content.svelte.d.ts +11 -0
  350. package/dist/trigger-menu-editor.svelte +32 -0
  351. package/dist/trigger-menu-editor.svelte.d.ts +13 -0
  352. package/dist/trigger-menu-empty.svelte +29 -0
  353. package/dist/trigger-menu-empty.svelte.d.ts +15 -0
  354. package/dist/trigger-menu-group-label.svelte +16 -0
  355. package/dist/trigger-menu-group-label.svelte.d.ts +9 -0
  356. package/dist/trigger-menu-group.svelte +16 -0
  357. package/dist/trigger-menu-group.svelte.d.ts +9 -0
  358. package/dist/trigger-menu-hint.svelte +16 -0
  359. package/dist/trigger-menu-hint.svelte.d.ts +9 -0
  360. package/dist/trigger-menu-inline.svelte.d.ts +59 -0
  361. package/dist/trigger-menu-inline.svelte.js +72 -0
  362. package/dist/trigger-menu-input.svelte +24 -0
  363. package/dist/trigger-menu-input.svelte.d.ts +6 -0
  364. package/dist/trigger-menu-item-icon.svelte +18 -0
  365. package/dist/trigger-menu-item-icon.svelte.d.ts +11 -0
  366. package/dist/trigger-menu-item.svelte +40 -0
  367. package/dist/trigger-menu-item.svelte.d.ts +19 -0
  368. package/dist/trigger-menu-list.svelte +20 -0
  369. package/dist/trigger-menu-list.svelte.d.ts +12 -0
  370. package/dist/trigger-menu-separator.svelte +13 -0
  371. package/dist/trigger-menu-separator.svelte.d.ts +6 -0
  372. package/dist/trigger-menu-status.svelte +21 -0
  373. package/dist/trigger-menu-status.svelte.d.ts +10 -0
  374. package/dist/trigger-menu.svelte +150 -0
  375. package/dist/trigger-menu.svelte.d.ts +30 -0
  376. package/dist/virtual-list-strict.svelte +83 -0
  377. package/dist/virtual-list-strict.svelte.d.ts +23 -0
  378. package/dist/virtual-list.svelte +86 -0
  379. package/dist/virtual-list.svelte.d.ts +28 -0
  380. package/dist/virtual.svelte.d.ts +24 -0
  381. package/dist/virtual.svelte.js +48 -0
  382. package/dist/waterfall-axis.svelte +25 -0
  383. package/dist/waterfall-axis.svelte.d.ts +14 -0
  384. package/dist/waterfall-bar.svelte +23 -0
  385. package/dist/waterfall-bar.svelte.d.ts +7 -0
  386. package/dist/waterfall-cell.svelte +13 -0
  387. package/dist/waterfall-cell.svelte.d.ts +7 -0
  388. package/dist/waterfall-chart.svelte +134 -0
  389. package/dist/waterfall-chart.svelte.d.ts +27 -0
  390. package/dist/waterfall-column-header.svelte +13 -0
  391. package/dist/waterfall-column-header.svelte.d.ts +7 -0
  392. package/dist/waterfall-header-row.svelte +13 -0
  393. package/dist/waterfall-header-row.svelte.d.ts +7 -0
  394. package/dist/waterfall-indicator.svelte +32 -0
  395. package/dist/waterfall-indicator.svelte.d.ts +7 -0
  396. package/dist/waterfall-mark.svelte +26 -0
  397. package/dist/waterfall-mark.svelte.d.ts +9 -0
  398. package/dist/waterfall-row-header.svelte +13 -0
  399. package/dist/waterfall-row-header.svelte.d.ts +7 -0
  400. package/dist/waterfall-row.svelte +39 -0
  401. package/dist/waterfall-row.svelte.d.ts +9 -0
  402. package/dist/waterfall-tick.svelte +25 -0
  403. package/dist/waterfall-tick.svelte.d.ts +9 -0
  404. package/dist/waterfall-trace.d.ts +17 -0
  405. package/dist/waterfall-trace.js +10 -0
  406. package/dist/waterfall.svelte +177 -0
  407. package/dist/waterfall.svelte.d.ts +48 -0
  408. package/package.json +447 -3
  409. package/README.md +0 -3
@@ -0,0 +1,74 @@
1
+ <script module lang="ts">
2
+ // @stable — follows semver.
3
+ import type { Snippet } from "svelte";
4
+ import type { Child, PrimitiveSwitchOptions } from "@bevelo/core";
5
+ import type { PrimitiveProps } from "./props.js";
6
+
7
+ /** Props for `Switch`. `checked` is bindable. */
8
+ export interface SwitchProps
9
+ extends PrimitiveProps<
10
+ PrimitiveSwitchOptions,
11
+ {
12
+ /** The host's mark inside the thumb: a snippet or a description list. */
13
+ indicator?: Snippet | readonly Child[] | undefined;
14
+ /** The mark, when `indicator` is not given. */
15
+ children?: Snippet | undefined;
16
+ /** Makes the form carrier required, so an unchecked switch blocks submission. */
17
+ required?: boolean | undefined;
18
+ },
19
+ HTMLButtonElement
20
+ > {}
21
+ </script>
22
+
23
+ <script lang="ts">
24
+ // The Svelte adapter for `Switch` on the headless path: the primitive owns
25
+ // the toggle machine; Svelte owns the elements. A labelled switch wraps the
26
+ // control in the label part so the text activates it.
27
+ import { switchPrimitive } from "@bevelo/core";
28
+ import type { PrimitiveSwitchApi } from "@bevelo/core";
29
+ import { usePrimitive, partProps, splitOptions } from "./headless.svelte.js";
30
+ import { forwardCancelable } from "./bound.svelte.js";
31
+ import Describe from "./describe.svelte";
32
+ import HiddenInput from "./hidden-input.svelte";
33
+
34
+ let { checked = $bindable(), indicator, children, required = false, ...rest }: SwitchProps = $props();
35
+
36
+ const split = $derived(splitOptions(switchPrimitive, rest));
37
+ const _uid = $props.id();
38
+ const handle = usePrimitive(switchPrimitive, () => ({
39
+ ...split.options,
40
+ checked,
41
+ indicator: indicator !== undefined,
42
+ onChange: forwardCancelable(split.options.onChange, (next) => {
43
+ checked = next;
44
+ }),
45
+ }), _uid);
46
+
47
+ /** The primitive's api: `toggle`, `checked`, `setChecked`. */
48
+ export function api(): PrimitiveSwitchApi {
49
+ return handle.api as PrimitiveSwitchApi;
50
+ }
51
+
52
+ const carrier = $derived(required ? { required: true } : undefined);
53
+ const root = $derived(handle.part("root"));
54
+ const labelPart = $derived(handle.part("label"));
55
+ const labelText = $derived(handle.part("label-text"));
56
+ const thumb = $derived(handle.part("thumb"));
57
+ const input = $derived(handle.part("input"));
58
+ const state = $derived(handle.state as { labelled?: boolean });
59
+ const mark = $derived(indicator ?? children);
60
+ const label = $derived(split.options.label);
61
+ </script>
62
+
63
+ {#snippet thumbContent()}
64
+ {#if Array.isArray(mark)}{#each mark as child}<Describe node={child} />{/each}{:else if typeof mark === "function"}{@render mark()}{/if}
65
+ {/snippet}
66
+
67
+ {#if root}
68
+ {@const control = root}
69
+ {#if state.labelled === true && labelPart}
70
+ <svelte:element this={labelPart.tag} {...partProps(labelPart, split.attrs)}>{#if labelText}<svelte:element this={labelText.tag} {...partProps(labelText)}>{label}</svelte:element>{/if}<svelte:element this={control.tag} {...partProps(control)}>{#if thumb}<svelte:element this={thumb.tag} {...partProps(thumb)}>{@render thumbContent()}</svelte:element>{/if}<HiddenInput part={input} extra={carrier} /></svelte:element></svelte:element>
71
+ {:else}
72
+ <svelte:element this={control.tag} {...partProps(control, split.attrs)}>{#if thumb}<svelte:element this={thumb.tag} {...partProps(thumb)}>{@render thumbContent()}</svelte:element>{/if}<HiddenInput part={input} extra={carrier} /></svelte:element>
73
+ {/if}
74
+ {/if}
@@ -0,0 +1,19 @@
1
+ import type { Snippet } from "svelte";
2
+ import type { Child, PrimitiveSwitchOptions } from "@bevelo/core";
3
+ import type { PrimitiveProps } from "./props.js";
4
+ /** Props for `Switch`. `checked` is bindable. */
5
+ export interface SwitchProps extends PrimitiveProps<PrimitiveSwitchOptions, {
6
+ /** The host's mark inside the thumb: a snippet or a description list. */
7
+ indicator?: Snippet | readonly Child[] | undefined;
8
+ /** The mark, when `indicator` is not given. */
9
+ children?: Snippet | undefined;
10
+ /** Makes the form carrier required, so an unchecked switch blocks submission. */
11
+ required?: boolean | undefined;
12
+ }, HTMLButtonElement> {
13
+ }
14
+ import type { PrimitiveSwitchApi } from "@bevelo/core";
15
+ declare const Switch: import("svelte").Component<SwitchProps, {
16
+ api: () => PrimitiveSwitchApi;
17
+ }, "checked">;
18
+ type Switch = ReturnType<typeof Switch>;
19
+ export default Switch;
@@ -0,0 +1,151 @@
1
+ <script module lang="ts">
2
+ // @stable — follows semver.
3
+ import type { Snippet } from "svelte";
4
+ import type { PrimitiveTableOptions, TableCell, TableColumn, TableRow } from "@bevelo/core";
5
+ import type { PrimitiveProps } from "./props.js";
6
+
7
+ /** One body cell, as the `cell` snippet receives it. */
8
+ export interface TableCellState {
9
+ readonly row: TableRow;
10
+ readonly column: TableColumn;
11
+ /** What the cell shows by default: `column.cell(row)` or `row.cells[columnIndex]`. */
12
+ readonly value: TableCell | undefined;
13
+ readonly rowIndex: number;
14
+ readonly columnIndex: number;
15
+ }
16
+
17
+ /** Props for `Table`. `selected`, `sortedBy` and `sortDirection` are bindable. */
18
+ export interface TableProps
19
+ extends PrimitiveProps<
20
+ PrimitiveTableOptions,
21
+ {
22
+ /** Renders a body cell's content; the cell value when left out. */
23
+ cell?: Snippet<[TableCellState]> | undefined;
24
+ /** Renders a column header's content; the header text when left out. */
25
+ header?: Snippet<[TableColumn]> | undefined;
26
+ },
27
+ HTMLTableElement
28
+ > {}
29
+ </script>
30
+
31
+ <script lang="ts">
32
+ // The Svelte adapter for `Table` on the headless path: the primitive owns
33
+ // the sort/selection machine and the grid keyboard contract; Svelte owns the
34
+ // rows. Focus follows the machine: a prevented default on a grid key is the
35
+ // primitive saying the cursor moved, and the probe puts the ring on the row
36
+ // it names.
37
+ import { tablePrimitive, tableCellValue } from "@bevelo/core";
38
+ import type { Child } from "@bevelo/core";
39
+ import { usePrimitive, partProps, splitOptions } from "./headless.svelte.js";
40
+ import Describe from "./describe.svelte";
41
+
42
+ const EMPTY_COLUMNS: readonly TableColumn[] = [];
43
+ const EMPTY_ROWS: readonly TableRow[] = [];
44
+
45
+ let {
46
+ selected = $bindable(),
47
+ sortedBy = $bindable(),
48
+ sortDirection = $bindable(),
49
+ cell,
50
+ header,
51
+ ...rest
52
+ }: TableProps = $props();
53
+
54
+ const split = $derived(splitOptions(tablePrimitive, rest));
55
+ const _uid = $props.id();
56
+ const handle = usePrimitive(tablePrimitive, () => {
57
+ const reportSelection = split.options.onChange;
58
+ const reportSort = split.options.onSortChange;
59
+ return {
60
+ ...split.options,
61
+ selected,
62
+ sortedBy,
63
+ sortDirection,
64
+ onChange: (ids) => {
65
+ selected = ids;
66
+ reportSelection?.(ids);
67
+ },
68
+ onSortChange: (sort) => {
69
+ sortedBy = sort?.id ?? "";
70
+ sortDirection = sort?.direction;
71
+ reportSort?.(sort);
72
+ },
73
+ };
74
+ }, _uid);
75
+
76
+ const root = $derived(handle.part("root"));
77
+ const captionPart = $derived(handle.part("caption"));
78
+ const head = $derived(handle.part("head"));
79
+ const body = $derived(handle.part("body"));
80
+ const selectAll = $derived(handle.part("select-all"));
81
+ const selectionHeader = $derived(handle.part("selection-header"));
82
+ const emptyRow = $derived(handle.part("empty-row"));
83
+ const emptyCell = $derived(handle.part("empty-cell"));
84
+
85
+ const columnList = $derived(split.options.columns ?? EMPTY_COLUMNS);
86
+ const rowList = $derived(split.options.rows ?? EMPTY_ROWS);
87
+ const captionText = $derived(String((captionPart?.state as { caption?: unknown } | undefined)?.caption ?? ""));
88
+ const emptyText = $derived(String((emptyCell?.state as { label?: unknown } | undefined)?.label ?? ""));
89
+ </script>
90
+
91
+ {#snippet cellValue(value: TableCell | undefined)}
92
+ {#if typeof value === "string"}{value}{:else if Array.isArray(value)}{#each value as child}<Describe node={child as Child} />{/each}{/if}
93
+ {/snippet}
94
+
95
+ {#if root}
96
+ <svelte:element this={root.tag} {...partProps(root, split.attrs)}>
97
+ {#if captionPart}<svelte:element this={captionPart.tag} {...partProps(captionPart)}>{captionText}</svelte:element>{/if}
98
+ {#if head}
99
+ <svelte:element this={head.tag} {...partProps(head)}>
100
+ <tr>
101
+ {#if selectionHeader}
102
+ <svelte:element this={selectionHeader.tag} {...partProps(selectionHeader)}>
103
+ {#if selectAll}<svelte:element this={selectAll.tag} {...partProps(selectAll)}></svelte:element>{/if}
104
+ </svelte:element>
105
+ {/if}
106
+ {#each columnList as column, index (column.id)}
107
+ {@const columnPart = handle.part("column", { index })}
108
+ {@const sortButton = handle.part("sort-button", { index })}
109
+ {#if columnPart}
110
+ <svelte:element this={columnPart.tag} {...partProps(columnPart)}>{#if column.sortable === true && sortButton}<svelte:element this={sortButton.tag} {...partProps(sortButton)}>{#if header}{@render header(column)}{:else}{@render cellValue(column.header)}{/if}</svelte:element>{:else if header}{@render header(column)}{:else}{@render cellValue(column.header)}{/if}</svelte:element>
111
+ {/if}
112
+ {/each}
113
+ </tr>
114
+ </svelte:element>
115
+ {/if}
116
+ {#if body}
117
+ <svelte:element this={body.tag} {...partProps(body)}>
118
+ {#if rowList.length === 0}
119
+ {#if emptyRow}
120
+ <svelte:element this={emptyRow.tag} {...partProps(emptyRow)}>
121
+ {#if emptyCell}<svelte:element this={emptyCell.tag} {...partProps(emptyCell)}>{emptyText}</svelte:element>{/if}
122
+ </svelte:element>
123
+ {/if}
124
+ {:else}
125
+ {#each rowList as row, index (row.id)}
126
+ {@const address = { index }}
127
+ {@const rowPart = handle.part("row", address)}
128
+ {@const checkbox = handle.part("row-selection", address)}
129
+ {@const selectionCell = handle.part("selection-cell", address)}
130
+ {#if rowPart}
131
+ <svelte:element this={rowPart.tag} {...partProps(rowPart)}>
132
+ {#if selectionCell}
133
+ <svelte:element this={selectionCell.tag} {...partProps(selectionCell)}>
134
+ {#if checkbox}<svelte:element this={checkbox.tag} {...partProps(checkbox)}></svelte:element>{/if}
135
+ </svelte:element>
136
+ {/if}
137
+ {#each columnList as column, columnIndex (column.id)}
138
+ {@const cellPart = handle.part("cell", { index, scope: column.id })}
139
+ {@const value = tableCellValue(row, column, columnIndex)}
140
+ {#if cellPart}
141
+ <svelte:element this={cellPart.tag} {...partProps(cellPart)}>{#if cell}{@render cell({ row, column, value, rowIndex: index, columnIndex })}{:else}{@render cellValue(value)}{/if}</svelte:element>
142
+ {/if}
143
+ {/each}
144
+ </svelte:element>
145
+ {/if}
146
+ {/each}
147
+ {/if}
148
+ </svelte:element>
149
+ {/if}
150
+ </svelte:element>
151
+ {/if}
@@ -0,0 +1,23 @@
1
+ import type { Snippet } from "svelte";
2
+ import type { PrimitiveTableOptions, TableCell, TableColumn, TableRow } from "@bevelo/core";
3
+ import type { PrimitiveProps } from "./props.js";
4
+ /** One body cell, as the `cell` snippet receives it. */
5
+ export interface TableCellState {
6
+ readonly row: TableRow;
7
+ readonly column: TableColumn;
8
+ /** What the cell shows by default: `column.cell(row)` or `row.cells[columnIndex]`. */
9
+ readonly value: TableCell | undefined;
10
+ readonly rowIndex: number;
11
+ readonly columnIndex: number;
12
+ }
13
+ /** Props for `Table`. `selected`, `sortedBy` and `sortDirection` are bindable. */
14
+ export interface TableProps extends PrimitiveProps<PrimitiveTableOptions, {
15
+ /** Renders a body cell's content; the cell value when left out. */
16
+ cell?: Snippet<[TableCellState]> | undefined;
17
+ /** Renders a column header's content; the header text when left out. */
18
+ header?: Snippet<[TableColumn]> | undefined;
19
+ }, HTMLTableElement> {
20
+ }
21
+ declare const Table: import("svelte").Component<TableProps, {}, "selected" | "sortedBy" | "sortDirection">;
22
+ type Table = ReturnType<typeof Table>;
23
+ export default Table;
@@ -0,0 +1,97 @@
1
+ <script module lang="ts">
2
+ // @stable — follows semver.
3
+ import type { Snippet } from "svelte";
4
+ import type { PrimitiveTabsApi, PrimitiveTabsItem, PrimitiveTabsOptions } from "@bevelo/core";
5
+ import type { PrimitiveProps } from "./props.js";
6
+
7
+ /** One tab, as the `item` and `panel` snippets receive it. */
8
+ export interface TabsItemState {
9
+ readonly item: PrimitiveTabsItem;
10
+ readonly index: number;
11
+ readonly selected: boolean;
12
+ readonly disabled: boolean;
13
+ }
14
+
15
+ /** Props for `Tabs`. `value` is bindable. */
16
+ export interface TabsProps
17
+ extends PrimitiveProps<
18
+ PrimitiveTabsOptions,
19
+ {
20
+ /** Renders a tab's content after its icon; the label text when left out. */
21
+ item?: Snippet<[TabsItemState]> | undefined;
22
+ /** Renders a panel's content; the item's `content` when left out. */
23
+ panel?: Snippet<[TabsItemState]> | undefined;
24
+ },
25
+ HTMLDivElement
26
+ > {}
27
+ </script>
28
+
29
+ <script lang="ts">
30
+ // The Svelte adapter for `Tabs` on the headless path: Core owns selection,
31
+ // roving focus movement, and indicator box measurement; Svelte owns the
32
+ // elements.
33
+ import { tabsPrimitive } from "@bevelo/core";
34
+ import { usePrimitive, partProps, splitOptions } from "./headless.svelte.js";
35
+ import { forwardCancelable } from "./bound.svelte.js";
36
+ import Describe from "./describe.svelte";
37
+
38
+ const NO_ITEMS: readonly PrimitiveTabsItem[] = [];
39
+
40
+ let { value = $bindable(), item: itemSnippet, panel: panelSnippet, ...rest }: TabsProps = $props();
41
+
42
+ const split = $derived(splitOptions(tabsPrimitive, rest));
43
+ const _uid = $props.id();
44
+ const handle = usePrimitive(tabsPrimitive, () => ({
45
+ ...split.options,
46
+ value,
47
+ defaultValue: split.options.defaultValue ?? "",
48
+ orientation: split.options.orientation ?? "horizontal",
49
+ activationMode: split.options.activationMode ?? "automatic",
50
+ mountAllPanels: split.options.mountAllPanels !== false,
51
+ disabled: split.options.disabled === true,
52
+ items: split.options.items ?? NO_ITEMS,
53
+ label: split.options.label ?? "",
54
+ indicator: split.options.indicator === true,
55
+ onChange: forwardCancelable(split.options.onChange, (next) => {
56
+ value = next;
57
+ }),
58
+ }), _uid);
59
+
60
+ /** The primitive's api: `select`, `selectedValue`, `setFocus`, `focusValue` and the id lookups. */
61
+ export function api(): PrimitiveTabsApi {
62
+ return handle.api;
63
+ }
64
+
65
+ const root = $derived(handle.part("root"));
66
+ const list = $derived(handle.part("list"));
67
+ const indicatorPart = $derived(handle.part("indicator"));
68
+ const itemList = $derived(split.options.items ?? NO_ITEMS);
69
+
70
+ function itemState(item: PrimitiveTabsItem, index: number): TabsItemState {
71
+ const state = handle.part("tab", { index })?.state as { selected?: boolean; disabled?: boolean } | undefined;
72
+ return { item, index, selected: state?.selected === true, disabled: state?.disabled === true };
73
+ }
74
+ </script>
75
+
76
+ {#if root}
77
+ <svelte:element this={root.tag} {...partProps(root, split.attrs)}>
78
+ {#if list}
79
+ <svelte:element this={list.tag} {...partProps(list)}>
80
+ {#each itemList as item, index (item.value)}
81
+ {@const tab = handle.part("tab", { index })}
82
+ {@const icon = handle.part("icon", { index })}
83
+ {#if tab}
84
+ <svelte:element this={tab.tag} {...partProps(tab)}>{#if icon && item.icon !== undefined}<svelte:element this={icon.tag} {...partProps(icon)}>{#each item.icon as child}<Describe node={child} />{/each}</svelte:element>{/if}{#if itemSnippet}{@render itemSnippet(itemState(item, index))}{:else}{item.label}{/if}</svelte:element>
85
+ {/if}
86
+ {/each}
87
+ {#if indicatorPart}<svelte:element this={indicatorPart.tag} {...partProps(indicatorPart)}></svelte:element>{/if}
88
+ </svelte:element>
89
+ {/if}
90
+ {#each itemList as item, index ("panel:" + item.value)}
91
+ {@const panel = handle.part("panel", { index })}
92
+ {#if panel}
93
+ <svelte:element this={panel.tag} {...partProps(panel)}>{#if panelSnippet}{@render panelSnippet(itemState(item, index))}{:else if item.content !== undefined}{#each item.content as child}<Describe node={child} />{/each}{/if}</svelte:element>
94
+ {/if}
95
+ {/each}
96
+ </svelte:element>
97
+ {/if}
@@ -0,0 +1,23 @@
1
+ import type { Snippet } from "svelte";
2
+ import type { PrimitiveTabsApi, PrimitiveTabsItem, PrimitiveTabsOptions } from "@bevelo/core";
3
+ import type { PrimitiveProps } from "./props.js";
4
+ /** One tab, as the `item` and `panel` snippets receive it. */
5
+ export interface TabsItemState {
6
+ readonly item: PrimitiveTabsItem;
7
+ readonly index: number;
8
+ readonly selected: boolean;
9
+ readonly disabled: boolean;
10
+ }
11
+ /** Props for `Tabs`. `value` is bindable. */
12
+ export interface TabsProps extends PrimitiveProps<PrimitiveTabsOptions, {
13
+ /** Renders a tab's content after its icon; the label text when left out. */
14
+ item?: Snippet<[TabsItemState]> | undefined;
15
+ /** Renders a panel's content; the item's `content` when left out. */
16
+ panel?: Snippet<[TabsItemState]> | undefined;
17
+ }, HTMLDivElement> {
18
+ }
19
+ declare const Tabs: import("svelte").Component<TabsProps, {
20
+ api: () => PrimitiveTabsApi;
21
+ }, "value">;
22
+ type Tabs = ReturnType<typeof Tabs>;
23
+ export default Tabs;
@@ -0,0 +1,65 @@
1
+ <script module lang="ts">
2
+ // @stable — follows semver.
3
+ import type { Snippet } from "svelte";
4
+ import type { PrimitiveTextareaOptions } from "@bevelo/core";
5
+ import type { PrimitiveProps } from "./props.js";
6
+
7
+ /** Props for `Textarea`. `value` is bindable. */
8
+ export interface TextareaProps
9
+ extends PrimitiveProps<
10
+ PrimitiveTextareaOptions,
11
+ {
12
+ /** The clear button's mark. */
13
+ clearIcon?: string | Snippet | undefined;
14
+ },
15
+ HTMLDivElement
16
+ > {}
17
+ </script>
18
+
19
+ <script lang="ts">
20
+ // The Svelte adapter for `Textarea` on the headless path: the primitive and its
21
+ // Core bindings own the value machine, focus restoration, count, and
22
+ // autosize; Svelte owns the elements.
23
+ import { textareaPrimitive } from "@bevelo/core";
24
+ import type { PrimitiveTextareaApi } from "@bevelo/core";
25
+ import { fieldApi } from "./field-api.js";
26
+ import { usePrimitive, partProps, splitOptions } from "./headless.svelte.js";
27
+
28
+ let { value = $bindable(), clearIcon = "×", ...rest }: TextareaProps = $props();
29
+
30
+ const split = $derived(splitOptions(textareaPrimitive, rest));
31
+ const _uid = $props.id();
32
+ const handle = usePrimitive(textareaPrimitive, () => {
33
+ const report = split.options.onChange;
34
+ return {
35
+ ...split.options,
36
+ value,
37
+ onChange: (next: string) => {
38
+ value = next;
39
+ report?.(next);
40
+ },
41
+ };
42
+ }, _uid);
43
+
44
+ let controlElement = $state<HTMLElement | undefined>();
45
+
46
+ /** The primitive's api plus `focus`; `clear` puts focus back in the field. */
47
+ export function api(): PrimitiveTextareaApi & { focus(): void } {
48
+ return fieldApi(handle.api as PrimitiveTextareaApi, () => controlElement);
49
+ }
50
+
51
+ const root = $derived(handle.part("root"));
52
+ const control = $derived(handle.part("control"));
53
+ const clear = $derived(handle.part("clear"));
54
+ const clearIconPart = $derived(handle.part("clear-icon"));
55
+ const counter = $derived(handle.part("counter"));
56
+ const counterState = $derived(counter?.state as { text?: string } | undefined);
57
+ </script>
58
+
59
+ {#snippet clearMark()}
60
+ {#if typeof clearIcon === "function"}{@render clearIcon()}{:else}{clearIcon}{/if}
61
+ {/snippet}
62
+
63
+ {#if root}
64
+ <svelte:element this={root.tag} {...partProps(root, split.attrs)}>{#if control}<svelte:element this={control.tag} bind:this={controlElement} {...partProps(control)}></svelte:element>{/if}{#if clear}<svelte:element this={clear.tag} {...partProps(clear)}>{#if clearIconPart}<svelte:element this={clearIconPart.tag} {...partProps(clearIconPart)}>{@render clearMark()}</svelte:element>{:else}{@render clearMark()}{/if}</svelte:element>{/if}{#if counter}<svelte:element this={counter.tag} {...partProps(counter)}>{counterState?.text ?? ""}</svelte:element>{/if}</svelte:element>
65
+ {/if}
@@ -0,0 +1,17 @@
1
+ import type { Snippet } from "svelte";
2
+ import type { PrimitiveTextareaOptions } from "@bevelo/core";
3
+ import type { PrimitiveProps } from "./props.js";
4
+ /** Props for `Textarea`. `value` is bindable. */
5
+ export interface TextareaProps extends PrimitiveProps<PrimitiveTextareaOptions, {
6
+ /** The clear button's mark. */
7
+ clearIcon?: string | Snippet | undefined;
8
+ }, HTMLDivElement> {
9
+ }
10
+ import type { PrimitiveTextareaApi } from "@bevelo/core";
11
+ declare const Textarea: import("svelte").Component<TextareaProps, {
12
+ api: () => PrimitiveTextareaApi & {
13
+ focus(): void;
14
+ };
15
+ }, "value">;
16
+ type Textarea = ReturnType<typeof Textarea>;
17
+ export default Textarea;
@@ -0,0 +1,128 @@
1
+ <script module lang="ts">
2
+ // @stable — follows semver.
3
+ import type { PrimitiveTimeInputOptions, TimeValue } from "@bevelo/core";
4
+ import type { PrimitiveProps } from "./props.js";
5
+
6
+ /** A time as a `TimeValue`, or as `"HH:MM"` text. */
7
+ export type TimeInputValue = TimeValue | string | null;
8
+
9
+ /** Props for `TimeInput`. `value` is bindable. */
10
+ export interface TimeInputProps
11
+ extends PrimitiveProps<
12
+ PrimitiveTimeInputOptions,
13
+ {
14
+ /** Controlled time. Text in means text out: `onChange` then reports `"HH:MM"` or `null`. */
15
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- bindable to a `TimeValue` or to text
16
+ value?: any;
17
+ defaultValue?: TimeInputValue | undefined;
18
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- a `TimeValue` or `"HH:MM"` text, following the value the host passed
19
+ onChange?: ((value: any) => void) | undefined;
20
+ /** `12` shows a 12-hour clock, `24` a 24-hour one; `hour12` wins when both are set. */
21
+ hourCycle?: 12 | 24 | undefined;
22
+ /** `"second"` submits `HH:MM:00`; the fields stay hour and minute. */
23
+ granularity?: "hour" | "minute" | "second" | undefined;
24
+ /** Form field name: a named time renders a hidden `HH:MM` input. */
25
+ name?: string | undefined;
26
+ required?: boolean | undefined;
27
+ /** The text between the hour and minute fields. */
28
+ separator?: string | undefined;
29
+ /** The 12-hour period button's text before noon. */
30
+ amLabel?: string | undefined;
31
+ /** The 12-hour period button's text from noon on. */
32
+ pmLabel?: string | undefined;
33
+ },
34
+ HTMLDivElement
35
+ > {}
36
+ </script>
37
+
38
+ <script lang="ts">
39
+ // The Svelte adapter for `TimeInput` on the headless path: the primitive owns
40
+ // the segment machines; Svelte owns the elements — one field, or hour,
41
+ // separator, minute and, on a 12-hour clock, the period button.
42
+ import { parseTimeText, timeInputPrimitive, timeValueText } from "@bevelo/core";
43
+ import type { PrimitiveInput } from "@bevelo/core";
44
+ import { usePrimitive, partProps, splitOptions } from "./headless.svelte.js";
45
+ import { bound } from "./bound.svelte.js";
46
+
47
+ let {
48
+ value = $bindable(),
49
+ defaultValue,
50
+ onChange,
51
+ hourCycle,
52
+ granularity,
53
+ name,
54
+ required = false,
55
+ separator = ":",
56
+ amLabel = "AM",
57
+ pmLabel = "PM",
58
+ ...rest
59
+ }: TimeInputProps = $props();
60
+
61
+ const toTime = (input: TimeInputValue | undefined): TimeValue | undefined =>
62
+ input === undefined || input === null ? undefined : typeof input === "string" ? parseTimeText(input) : input;
63
+
64
+ const split = $derived(splitOptions(timeInputPrimitive, rest));
65
+ const valueBound = bound(toTime(value));
66
+ const optionsOf = (): PrimitiveInput<PrimitiveTimeInputOptions> => {
67
+ const textMode = typeof value === "string" || value === null || typeof defaultValue === "string";
68
+ return {
69
+ ...split.options,
70
+ value: valueBound.option(toTime(value)),
71
+ defaultValue: toTime(value) ?? toTime(defaultValue),
72
+ hour12: split.options.hour12 ?? hourCycle === 12,
73
+ onChange: (next) => {
74
+ valueBound.reported(next);
75
+ const reported = textMode ? (next === undefined ? null : timeValueText(next)) : next;
76
+ value = reported;
77
+ onChange?.(reported);
78
+ },
79
+ };
80
+ };
81
+ const _uid = $props.id();
82
+ const handle = usePrimitive(timeInputPrimitive, optionsOf, _uid);
83
+
84
+ // A time the host refused must show the host's value again. The primitive
85
+ // keeps the typed text so invalid intermediate edits can exist, so the
86
+ // adapter re-syncs the options after input/blur gestures. The chained
87
+ // listener must run after the primitive's own listener, not through
88
+ // partProps' host-first merge.
89
+ function restoreControlled(): void {
90
+ if (value === undefined) return;
91
+ handle.instance.update(optionsOf() as never);
92
+ }
93
+
94
+ function afterPrimitive(part: Parameters<typeof partProps>[0]): Record<string, unknown> {
95
+ const props = partProps(part);
96
+ for (const key of ["oninput", "onblur"] as const) {
97
+ const primitiveListener = props[key];
98
+ props[key] = (event: Event) => {
99
+ if (typeof primitiveListener === "function") primitiveListener(event);
100
+ restoreControlled();
101
+ if (value !== undefined && event.currentTarget instanceof HTMLInputElement) {
102
+ const text = (part?.state as { text?: unknown } | undefined)?.text;
103
+ if (typeof text === "string") event.currentTarget.value = text;
104
+ }
105
+ };
106
+ }
107
+ return props;
108
+ }
109
+
110
+ const root = $derived(handle.part("root"));
111
+ const timeState = $derived(handle.state as { singleField?: boolean; value?: TimeValue });
112
+ const input = $derived(handle.part("input"));
113
+ const hour = $derived(handle.part("input-segment", { index: 0 }));
114
+ const minute = $derived(handle.part("input-segment", { index: 1 }));
115
+ const separatorPart = $derived(handle.part("separator"));
116
+ const period = $derived(handle.part("period"));
117
+ const pm = $derived((period?.state as { pm?: boolean } | undefined)?.pm === true);
118
+ </script>
119
+
120
+ {#snippet carrier()}{#if name !== undefined}<input type="hidden" {name} required={required || undefined} value={timeValueText(timeState.value, granularity === "second")} />{/if}{/snippet}
121
+
122
+ {#if root}
123
+ {#if timeState.singleField === true}
124
+ <svelte:element this={root.tag} {...partProps(root, split.attrs)}>{#if input}<svelte:element this={input.tag} {...afterPrimitive(input)}></svelte:element>{/if}{@render carrier()}</svelte:element>
125
+ {:else}
126
+ <svelte:element this={root.tag} {...partProps(root, split.attrs)}>{#if hour}<svelte:element this={hour.tag} {...afterPrimitive(hour)}></svelte:element>{/if}{#if separatorPart}<svelte:element this={separatorPart.tag} {...partProps(separatorPart)}>{separator}</svelte:element>{/if}{#if minute}<svelte:element this={minute.tag} {...afterPrimitive(minute)}></svelte:element>{/if}{#if period}<svelte:element this={period.tag} {...partProps(period)}>{pm ? pmLabel : amLabel}</svelte:element>{/if}{@render carrier()}</svelte:element>
127
+ {/if}
128
+ {/if}
@@ -0,0 +1,28 @@
1
+ import type { PrimitiveTimeInputOptions, TimeValue } from "@bevelo/core";
2
+ import type { PrimitiveProps } from "./props.js";
3
+ /** A time as a `TimeValue`, or as `"HH:MM"` text. */
4
+ export type TimeInputValue = TimeValue | string | null;
5
+ /** Props for `TimeInput`. `value` is bindable. */
6
+ export interface TimeInputProps extends PrimitiveProps<PrimitiveTimeInputOptions, {
7
+ /** Controlled time. Text in means text out: `onChange` then reports `"HH:MM"` or `null`. */
8
+ value?: any;
9
+ defaultValue?: TimeInputValue | undefined;
10
+ onChange?: ((value: any) => void) | undefined;
11
+ /** `12` shows a 12-hour clock, `24` a 24-hour one; `hour12` wins when both are set. */
12
+ hourCycle?: 12 | 24 | undefined;
13
+ /** `"second"` submits `HH:MM:00`; the fields stay hour and minute. */
14
+ granularity?: "hour" | "minute" | "second" | undefined;
15
+ /** Form field name: a named time renders a hidden `HH:MM` input. */
16
+ name?: string | undefined;
17
+ required?: boolean | undefined;
18
+ /** The text between the hour and minute fields. */
19
+ separator?: string | undefined;
20
+ /** The 12-hour period button's text before noon. */
21
+ amLabel?: string | undefined;
22
+ /** The 12-hour period button's text from noon on. */
23
+ pmLabel?: string | undefined;
24
+ }, HTMLDivElement> {
25
+ }
26
+ declare const TimeInput: import("svelte").Component<TimeInputProps, {}, "value">;
27
+ type TimeInput = ReturnType<typeof TimeInput>;
28
+ export default TimeInput;