@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,120 @@
1
+ <script module lang="ts">
2
+ // @stable — follows semver.
3
+ import type { Snippet } from "svelte";
4
+ import type { HTMLAttributes } from "svelte/elements";
5
+ import type { SegmentToken, TokenSegments, TokenSegmentsChangeDetails } from "@bevelo/core";
6
+
7
+ /** Props for the composed TokenInput: mixed text and token segments. */
8
+ export type TokenInputSegmentsRootProps = Omit<HTMLAttributes<HTMLDivElement>, "onchange" | "onsubmit"> & {
9
+ /** Controlled segments; bindable. Left out, the field keeps its own. */
10
+ value?: TokenSegments | undefined;
11
+ /** The segments an uncontrolled field starts with. */
12
+ defaultValue?: TokenSegments | undefined;
13
+ disabled?: boolean | undefined;
14
+ readOnly?: boolean | undefined;
15
+ label?: string | undefined;
16
+ onChange?: ((value: TokenSegments, details: TokenSegmentsChangeDetails) => void) | undefined;
17
+ /** Enter in the editor: the segments and the editor's text. */
18
+ onSubmit?: ((value: TokenSegments) => void) | undefined;
19
+ /** Renders one token, usually a `TokenInputToken` with a `TokenInputTokenRemove`. */
20
+ token?: Snippet<[SegmentToken]> | undefined;
21
+ children: Snippet;
22
+ };
23
+ </script>
24
+
25
+ <script lang="ts">
26
+ // The composed root: creates core's segment store, shares it with the parts,
27
+ // and renders the text and the tokens ahead of the host's children.
28
+ import { onDestroy } from "svelte";
29
+ import { createTokenSegments } from "@bevelo/core";
30
+ import TokenInputToken from "./token-input-token.svelte";
31
+ import TokenInputTokenRemove from "./token-input-token-remove.svelte";
32
+ import TokenScope from "./token-input-token-scope.svelte";
33
+ import { setTokenSegmentsScope } from "./token-segments-scope.svelte.js";
34
+
35
+ let {
36
+ value = $bindable(),
37
+ defaultValue,
38
+ disabled = false,
39
+ readOnly = false,
40
+ label = "",
41
+ onChange,
42
+ onSubmit,
43
+ token,
44
+ children,
45
+ ...rest
46
+ }: TokenInputSegmentsRootProps = $props();
47
+
48
+ let editor: HTMLInputElement | null = null;
49
+ let version = $state(0);
50
+ // Captured once: the store reads the controlled value through `read` from then on.
51
+ const controlled = value !== undefined;
52
+ const store = createTokenSegments({
53
+ // svelte-ignore state_referenced_locally
54
+ defaultValue,
55
+ editor: () => editor,
56
+ read: () => ({
57
+ value: controlled ? (value ?? []) : undefined,
58
+ disabled,
59
+ readOnly,
60
+ onChange: (next, details) => {
61
+ if (controlled) value = next;
62
+ onChange?.(next, details);
63
+ },
64
+ }),
65
+ });
66
+ onDestroy(store.subscribe(() => (version += 1)));
67
+
68
+ setTokenSegmentsScope({
69
+ store,
70
+ track: () => void version,
71
+ disabled: () => disabled,
72
+ readOnly: () => readOnly,
73
+ setEditor: (next) => (editor = next),
74
+ focusEditor: () => editor?.focus(),
75
+ submit: () => onSubmit?.(store.submitValue()),
76
+ });
77
+
78
+ const segments = $derived.by(() => {
79
+ void version;
80
+ void value;
81
+ return store.value();
82
+ });
83
+
84
+ /** The segments' api: read, insert, update, remove, undo, clear and focus. */
85
+ export function api() {
86
+ return {
87
+ getValue: store.value,
88
+ getLabel: store.label,
89
+ insert: store.insert,
90
+ updateToken: store.updateToken,
91
+ removeToken: store.removeToken,
92
+ undo: store.undo,
93
+ clear: store.clear,
94
+ focus: () => editor?.focus(),
95
+ };
96
+ }
97
+ </script>
98
+
99
+ <!-- svelte-ignore a11y_role_supports_aria_props -->
100
+ <div
101
+ {...rest}
102
+ role="group"
103
+ data-slot="token-input"
104
+ aria-label={label || undefined}
105
+ aria-disabled={disabled ? "true" : undefined}
106
+ aria-readonly={readOnly ? "true" : undefined}
107
+ data-disabled={disabled ? "" : undefined}
108
+ data-readonly={readOnly ? "" : undefined}
109
+ >
110
+ {#each segments as segment, index (typeof segment === "string" ? `text-${index}` : (segment.id ?? index))}
111
+ {#if typeof segment === "string"}
112
+ <span data-part="input-text">{segment}</span>
113
+ {:else}
114
+ <TokenScope token={segment}>
115
+ {#if token}{@render token(segment)}{:else}<TokenInputToken>{segment.label}<TokenInputTokenRemove /></TokenInputToken>{/if}
116
+ </TokenScope>
117
+ {/if}
118
+ {/each}
119
+ {@render children()}
120
+ </div>
@@ -0,0 +1,33 @@
1
+ import type { Snippet } from "svelte";
2
+ import type { HTMLAttributes } from "svelte/elements";
3
+ import type { SegmentToken, TokenSegments, TokenSegmentsChangeDetails } from "@bevelo/core";
4
+ /** Props for the composed TokenInput: mixed text and token segments. */
5
+ export type TokenInputSegmentsRootProps = Omit<HTMLAttributes<HTMLDivElement>, "onchange" | "onsubmit"> & {
6
+ /** Controlled segments; bindable. Left out, the field keeps its own. */
7
+ value?: TokenSegments | undefined;
8
+ /** The segments an uncontrolled field starts with. */
9
+ defaultValue?: TokenSegments | undefined;
10
+ disabled?: boolean | undefined;
11
+ readOnly?: boolean | undefined;
12
+ label?: string | undefined;
13
+ onChange?: ((value: TokenSegments, details: TokenSegmentsChangeDetails) => void) | undefined;
14
+ /** Enter in the editor: the segments and the editor's text. */
15
+ onSubmit?: ((value: TokenSegments) => void) | undefined;
16
+ /** Renders one token, usually a `TokenInputToken` with a `TokenInputTokenRemove`. */
17
+ token?: Snippet<[SegmentToken]> | undefined;
18
+ children: Snippet;
19
+ };
20
+ declare const TokenInputSegmentsRoot: import("svelte").Component<TokenInputSegmentsRootProps, {
21
+ api: () => {
22
+ getValue: () => TokenSegments;
23
+ getLabel: () => string;
24
+ insert: (segment: SegmentToken | string, options?: import("@bevelo/core").TokenSegmentsInsertOptions) => void;
25
+ updateToken: (id: string, patch: Partial<SegmentToken>) => void;
26
+ removeToken: (id: string) => void;
27
+ undo: () => void;
28
+ clear: () => void;
29
+ focus: () => void | undefined;
30
+ };
31
+ }, "value">;
32
+ type TokenInputSegmentsRoot = ReturnType<typeof TokenInputSegmentsRoot>;
33
+ export default TokenInputSegmentsRoot;
@@ -0,0 +1,32 @@
1
+ <script module lang="ts">
2
+ // @stable — follows semver.
3
+ </script>
4
+
5
+ <script lang="ts">
6
+ // Removes the token it sits in and returns focus to the editor.
7
+ import type { HTMLButtonAttributes } from "svelte/elements";
8
+ import { chain, getSegmentToken, getTokenSegmentsScope } from "./token-segments-scope.svelte.js";
9
+
10
+ let { children, ...rest }: HTMLButtonAttributes = $props();
11
+ const scope = getTokenSegmentsScope();
12
+ const token = getSegmentToken();
13
+ const locked = $derived.by(() => {
14
+ scope?.track();
15
+ return scope?.disabled() === true || scope?.readOnly() === true;
16
+ });
17
+ </script>
18
+
19
+ <button
20
+ type="button"
21
+ data-part="input-token-remove"
22
+ aria-label={token ? `Remove ${token().label}` : undefined}
23
+ disabled={locked || undefined}
24
+ {...rest}
25
+ onclick={(event) => {
26
+ chain(rest.onclick, event);
27
+ const id = token?.().id;
28
+ if (event.defaultPrevented || scope === undefined || id === undefined) return;
29
+ scope.store.removeToken(id);
30
+ scope.focusEditor();
31
+ }}
32
+ >{#if children}{@render children()}{:else}×{/if}</button>
@@ -0,0 +1,4 @@
1
+ import type { HTMLButtonAttributes } from "svelte/elements";
2
+ declare const TokenInputTokenRemove: import("svelte").Component<HTMLButtonAttributes, {}, "">;
3
+ type TokenInputTokenRemove = ReturnType<typeof TokenInputTokenRemove>;
4
+ export default TokenInputTokenRemove;
@@ -0,0 +1,15 @@
1
+ <script module lang="ts">
2
+ // @stable — follows semver.
3
+ </script>
4
+
5
+ <script lang="ts">
6
+ // Gives the parts inside one token that token.
7
+ import type { Snippet } from "svelte";
8
+ import type { SegmentToken } from "@bevelo/core";
9
+ import { setSegmentToken } from "./token-segments-scope.svelte.js";
10
+
11
+ let { token, children }: { token: SegmentToken; children: Snippet } = $props();
12
+ setSegmentToken(() => token);
13
+ </script>
14
+
15
+ {@render children()}
@@ -0,0 +1,9 @@
1
+ import type { Snippet } from "svelte";
2
+ import type { SegmentToken } from "@bevelo/core";
3
+ type $$ComponentProps = {
4
+ token: SegmentToken;
5
+ children: Snippet;
6
+ };
7
+ declare const TokenInputTokenScope: import("svelte").Component<$$ComponentProps, {}, "">;
8
+ type TokenInputTokenScope = ReturnType<typeof TokenInputTokenScope>;
9
+ export default TokenInputTokenScope;
@@ -0,0 +1,22 @@
1
+ <script module lang="ts">
2
+ // @stable — follows semver.
3
+ </script>
4
+
5
+ <script lang="ts">
6
+ // One token's element, carrying its type, id and status.
7
+ import type { HTMLAttributes } from "svelte/elements";
8
+ import { getSegmentToken } from "./token-segments-scope.svelte.js";
9
+
10
+ let { children, ...rest }: HTMLAttributes<HTMLSpanElement> = $props();
11
+ const token = getSegmentToken();
12
+ const current = $derived(token?.());
13
+ </script>
14
+
15
+ <span
16
+ data-part="input-token"
17
+ data-token-type={current?.type}
18
+ data-token-id={current?.id}
19
+ data-pending={current?.status === "pending" ? "" : undefined}
20
+ data-error={current?.status === "error" ? "" : undefined}
21
+ {...rest}
22
+ >{#if children}{@render children()}{:else}{current?.label}{/if}</span>
@@ -0,0 +1,4 @@
1
+ import type { HTMLAttributes } from "svelte/elements";
2
+ declare const TokenInputToken: import("svelte").Component<HTMLAttributes<HTMLSpanElement>, {}, "">;
3
+ type TokenInputToken = ReturnType<typeof TokenInputToken>;
4
+ export default TokenInputToken;
@@ -0,0 +1,157 @@
1
+ <script module lang="ts">
2
+ // @stable — follows semver.
3
+ import type { Snippet } from "svelte";
4
+ import type {
5
+ PrimitiveToken,
6
+ PrimitiveTokenInputOptions,
7
+ SegmentToken,
8
+ TokenSegments,
9
+ TokenSegmentsChangeDetails,
10
+ } from "@bevelo/core";
11
+ import type { PrimitiveProps } from "./props.js";
12
+
13
+ /** Props for `TokenInput`. `tokens` and `inputValue` are bindable. */
14
+ export interface TokenInputProps
15
+ extends PrimitiveProps<
16
+ PrimitiveTokenInputOptions,
17
+ {
18
+ /** Renders a chip's content inside its chip, or with `children` a whole token; the token's label when left out. */
19
+ token?: Snippet<[PrimitiveToken & Partial<SegmentToken>]> | undefined;
20
+ /** With `children`: controlled mixed text and token segments; bindable. */
21
+ value?: TokenSegments | undefined;
22
+ /** With `children`: the segments an uncontrolled field starts with. */
23
+ defaultValue?: TokenSegments | undefined;
24
+ /** Composed parts (`TokenInputEditor`, ...): the field holds mixed text and token segments. */
25
+ children?: Snippet | undefined;
26
+ /** The next token list, or with `children` the next segments and why they changed. */
27
+ onChange?(value: readonly PrimitiveToken[] | TokenSegments, details?: TokenSegmentsChangeDetails): void;
28
+ /** Renders a suggestion inside its option; the suggestion text when left out. */
29
+ option?: Snippet<[string]> | undefined;
30
+ /** The remove button's mark on each chip. */
31
+ removeIcon?: string | Snippet | undefined;
32
+ /** Shows the tokens but refuses every add and remove, staying focusable. */
33
+ readOnly?: boolean | undefined;
34
+ /** Enter in an empty editor: the tokens as `{ id, type, value, label }`; with `children`, the segments and the editor's text. */
35
+ onSubmit?: ((value: TokenSegments) => void) | undefined;
36
+ },
37
+ HTMLDivElement
38
+ > {}
39
+ </script>
40
+
41
+ <script lang="ts">
42
+ // The Svelte adapter for `TokenInput` on the headless path: the primitive
43
+ // owns the token machine, the suggestion window and the keyboard contract;
44
+ // Svelte owns the chips. Focus is the machine's: a prevented default inside
45
+ // the chips is it saying where the ring goes.
46
+ import { tokenInputPrimitive } from "@bevelo/core";
47
+ import type { PrimitiveTokenInputApi } from "@bevelo/core";
48
+ import { usePrimitive, partProps, splitOptions } from "./headless.svelte.js";
49
+ import TokenInputSegmentsRoot from "./token-input-segments-root.svelte";
50
+
51
+ const NO_TOKENS: readonly PrimitiveToken[] = [];
52
+
53
+ let {
54
+ tokens = $bindable(NO_TOKENS),
55
+ inputValue = $bindable(),
56
+ token,
57
+ option,
58
+ removeIcon = "×",
59
+ readOnly = false,
60
+ onSubmit,
61
+ value = $bindable(),
62
+ defaultValue,
63
+ children,
64
+ ...rest
65
+ }: TokenInputProps = $props();
66
+ let segmentsRoot: TokenInputSegmentsRoot | undefined = $state();
67
+
68
+ const tokenValues = (tokens: readonly PrimitiveToken[]) =>
69
+ tokens.map((token) => ({ id: token.id, type: "token", value: token.id, label: token.label }));
70
+
71
+ const split = $derived(splitOptions(tokenInputPrimitive, rest));
72
+ const _uid = $props.id();
73
+ const handle = usePrimitive(tokenInputPrimitive, () => {
74
+ const reportTokens = split.options.onChange;
75
+ const reportInput = split.options.onInput;
76
+ return {
77
+ ...split.options,
78
+ tokens,
79
+ inputValue,
80
+ onChange: (next: readonly PrimitiveToken[]) => {
81
+ if (readOnly) return;
82
+ tokens = next;
83
+ (reportTokens as ((tokens: readonly PrimitiveToken[]) => void) | undefined)?.(next);
84
+ },
85
+ onInput: (next: string) => {
86
+ inputValue = next;
87
+ reportInput?.(next);
88
+ },
89
+ };
90
+ }, _uid);
91
+
92
+ let editorElement: HTMLInputElement | undefined = $state();
93
+ const kernel = handle.api as PrimitiveTokenInputApi;
94
+
95
+ /** The primitive's api plus `getValue`, `getLabel`, `removeToken` and `focus`; with `children`, the segments' api. */
96
+ export function api() {
97
+ if (segmentsRoot !== undefined) return segmentsRoot.api();
98
+ return {
99
+ ...kernel,
100
+ getValue: () => tokenValues(kernel.tokens()),
101
+ getLabel: () => kernel.tokens().map((entry) => entry.label).join(", "),
102
+ removeToken: (id: string) => kernel.remove(id),
103
+ focus: () => editorElement?.focus(),
104
+ };
105
+ }
106
+
107
+ function submitOnEnter(event: KeyboardEvent): void {
108
+ if (event.key !== "Enter" || event.isComposing || (editorElement?.value ?? "") !== "") return;
109
+ onSubmit?.(tokenValues(kernel.tokens()));
110
+ }
111
+
112
+ const root = $derived(handle.part("root"));
113
+ const chips = $derived(handle.part("chips"));
114
+ const editor = $derived(handle.part("input-editor"));
115
+ const listbox = $derived(handle.part("listbox"));
116
+
117
+ const visible = $derived.by(() => {
118
+ handle.revision;
119
+ return handle.api.visibleOptions();
120
+ });
121
+ </script>
122
+
123
+ {#if children}
124
+ <TokenInputSegmentsRoot
125
+ bind:this={segmentsRoot}
126
+ bind:value
127
+ {defaultValue}
128
+ {children}
129
+ {readOnly}
130
+ token={token as never}
131
+ onSubmit={onSubmit as never}
132
+ {...(rest as Record<string, unknown>)}
133
+ />
134
+ {:else if root}
135
+ <svelte:element this={root.tag} {...partProps(root, split.attrs)}>
136
+ {#if chips}
137
+ <svelte:element this={chips.tag} {...partProps(chips)}>
138
+ {#each tokens as entry, index (entry.id)}
139
+ {@const chip = handle.part("input-token", { index })}
140
+ {@const remove = handle.part("input-token-remove", { index })}
141
+ {#if chip}
142
+ <svelte:element this={chip.tag} {...partProps(chip)}><span data-token-label="">{#if token}{@render token(entry)}{:else}{entry.label}{/if}</span>{#if remove}<svelte:element this={remove.tag} {...partProps(remove, readOnly ? { disabled: true } : {})}>{#if typeof removeIcon === "function"}{@render removeIcon()}{:else}{removeIcon}{/if}</svelte:element>{/if}</svelte:element>
143
+ {/if}
144
+ {/each}
145
+ </svelte:element>
146
+ {/if}
147
+ {#if editor}<svelte:element this={editor.tag} bind:this={editorElement} {...partProps(editor, { onkeydowncapture: submitOnEnter, ...(readOnly ? { readonly: true } : {}) })}></svelte:element>{/if}
148
+ {#if listbox}
149
+ <svelte:element this={listbox.tag} {...partProps(listbox)}>
150
+ {#each visible as suggestion, index (index)}
151
+ {@const optionPart = handle.part("option", { index })}
152
+ {#if optionPart}<svelte:element this={optionPart.tag} {...partProps(optionPart)}>{#if option}{@render option(suggestion)}{:else}{suggestion}{/if}</svelte:element>{/if}
153
+ {/each}
154
+ </svelte:element>
155
+ {/if}
156
+ </svelte:element>
157
+ {/if}
@@ -0,0 +1,66 @@
1
+ import type { Snippet } from "svelte";
2
+ import type { PrimitiveToken, PrimitiveTokenInputOptions, SegmentToken, TokenSegments, TokenSegmentsChangeDetails } from "@bevelo/core";
3
+ import type { PrimitiveProps } from "./props.js";
4
+ /** Props for `TokenInput`. `tokens` and `inputValue` are bindable. */
5
+ export interface TokenInputProps extends PrimitiveProps<PrimitiveTokenInputOptions, {
6
+ /** Renders a chip's content inside its chip, or with `children` a whole token; the token's label when left out. */
7
+ token?: Snippet<[PrimitiveToken & Partial<SegmentToken>]> | undefined;
8
+ /** With `children`: controlled mixed text and token segments; bindable. */
9
+ value?: TokenSegments | undefined;
10
+ /** With `children`: the segments an uncontrolled field starts with. */
11
+ defaultValue?: TokenSegments | undefined;
12
+ /** Composed parts (`TokenInputEditor`, ...): the field holds mixed text and token segments. */
13
+ children?: Snippet | undefined;
14
+ /** The next token list, or with `children` the next segments and why they changed. */
15
+ onChange?(value: readonly PrimitiveToken[] | TokenSegments, details?: TokenSegmentsChangeDetails): void;
16
+ /** Renders a suggestion inside its option; the suggestion text when left out. */
17
+ option?: Snippet<[string]> | undefined;
18
+ /** The remove button's mark on each chip. */
19
+ removeIcon?: string | Snippet | undefined;
20
+ /** Shows the tokens but refuses every add and remove, staying focusable. */
21
+ readOnly?: boolean | undefined;
22
+ /** Enter in an empty editor: the tokens as `{ id, type, value, label }`; with `children`, the segments and the editor's text. */
23
+ onSubmit?: ((value: TokenSegments) => void) | undefined;
24
+ }, HTMLDivElement> {
25
+ }
26
+ declare const TokenInput: import("svelte").Component<TokenInputProps, {
27
+ api: () => {
28
+ getValue: () => TokenSegments;
29
+ getLabel: () => string;
30
+ insert: (segment: SegmentToken | string, options?: import("@bevelo/core").TokenSegmentsInsertOptions) => void;
31
+ updateToken: (id: string, patch: Partial<SegmentToken>) => void;
32
+ removeToken: (id: string) => void;
33
+ undo: () => void;
34
+ clear: () => void;
35
+ focus: () => void | undefined;
36
+ } | {
37
+ getValue: () => {
38
+ id: string;
39
+ type: string;
40
+ value: string;
41
+ label: string;
42
+ }[];
43
+ getLabel: () => string;
44
+ removeToken: (id: string) => void;
45
+ focus: () => void | undefined;
46
+ tokens(): readonly PrimitiveToken[];
47
+ inputValue(): string;
48
+ visibleOptions(): string[];
49
+ activeIndex(): number;
50
+ isOpen(): boolean;
51
+ open(): void;
52
+ close(): void;
53
+ next(): void;
54
+ prev(): void;
55
+ add(label: string): void;
56
+ remove(id: string): void;
57
+ setInput(value: string): void;
58
+ setFocus(id: string): void;
59
+ stepFocus(delta: 1 | -1): void;
60
+ edgeFocus(to: "first" | "last"): void;
61
+ focusId(): string;
62
+ listboxId(): string;
63
+ };
64
+ }, "value" | "inputValue" | "tokens">;
65
+ type TokenInput = ReturnType<typeof TokenInput>;
66
+ export default TokenInput;
@@ -0,0 +1,17 @@
1
+ import type { SegmentToken, TokenSegmentsStore } from "@bevelo/core";
2
+ import { chain } from "./headless.svelte.js";
3
+ export { chain };
4
+ /** What the segments root shares with its parts. */
5
+ export interface TokenSegmentsScope {
6
+ readonly store: TokenSegmentsStore;
7
+ /** Reads the change counter so the caller re-runs on every change. */
8
+ track(): void;
9
+ disabled(): boolean;
10
+ readOnly(): boolean;
11
+ setEditor(editor: HTMLInputElement | null): void;
12
+ focusEditor(): void;
13
+ submit(): void;
14
+ }
15
+ export declare const setTokenSegmentsScope: (value: TokenSegmentsScope) => void, getTokenSegmentsScope: () => TokenSegmentsScope | undefined;
16
+ /** Gives the parts inside one token that token. */
17
+ export declare const setSegmentToken: (value: () => SegmentToken) => void, getSegmentToken: () => (() => SegmentToken) | undefined;
@@ -0,0 +1,11 @@
1
+ // The composed TokenInput on Svelte: what the segments root shares with its
2
+ // parts. Core's segment store owns the value, the undo stack and the editor
3
+ // keys; the parts read it through context and call `track` so their
4
+ // `$derived` re-runs whenever the store changes.
5
+ //
6
+ // @stable — follows semver.
7
+ import { chain, createContextScope } from "./headless.svelte.js";
8
+ export { chain };
9
+ export const [setTokenSegmentsScope, getTokenSegmentsScope] = createContextScope("token-input-segments");
10
+ /** Gives the parts inside one token that token. */
11
+ export const [setSegmentToken, getSegmentToken] = createContextScope("token-input-token");
@@ -0,0 +1,31 @@
1
+ <script module lang="ts">
2
+ // Internal: not exported from any public subpath.
3
+ import type { Snippet } from "svelte";
4
+ import type { PrimitivePart, ToolbarButtonItem, ToolbarItem, ToolbarLinkItem } from "@bevelo/core";
5
+
6
+ /** Props for the internal `ToolbarItemNode`. */
7
+ export interface ToolbarItemNodeProps {
8
+ /** The entry this node renders. */
9
+ item: ToolbarItem;
10
+ /** Looks up the toolbar's part for an entry kind and value. */
11
+ partOf: (name: string, scope: string) => PrimitivePart | undefined;
12
+ /** Renders a button's or link's label, after its icon. */
13
+ label?: Snippet<[ToolbarButtonItem | ToolbarLinkItem]> | undefined;
14
+ }
15
+ </script>
16
+
17
+ <script lang="ts">
18
+ // One toolbar item, recursive through groups: a group's children are more
19
+ // toolbar items, rendered by this same component.
20
+ import ToolbarItemNode from "./toolbar-item.svelte";
21
+ import Describe from "./describe.svelte";
22
+ import { partProps } from "./headless.svelte.js";
23
+
24
+ let { item, partOf, label }: ToolbarItemNodeProps = $props();
25
+
26
+ const part = $derived(partOf(item.kind ?? "button", item.value));
27
+ </script>
28
+
29
+ {#if part}
30
+ <svelte:element this={part.tag} {...partProps(part)}>{#if item.kind === "group"}{#each item.items as child (child.value)}<ToolbarItemNode item={child} {partOf} {label} />{/each}{:else if item.kind === undefined || item.kind === "button" || item.kind === "link"}{#each item.icon ?? [] as child}<Describe node={child} />{/each}{#if label}{@render label(item)}{:else}{item.label}{/if}{/if}</svelte:element>
31
+ {/if}
@@ -0,0 +1,14 @@
1
+ import type { Snippet } from "svelte";
2
+ import type { PrimitivePart, ToolbarButtonItem, ToolbarItem, ToolbarLinkItem } from "@bevelo/core";
3
+ /** Props for the internal `ToolbarItemNode`. */
4
+ export interface ToolbarItemNodeProps {
5
+ /** The entry this node renders. */
6
+ item: ToolbarItem;
7
+ /** Looks up the toolbar's part for an entry kind and value. */
8
+ partOf: (name: string, scope: string) => PrimitivePart | undefined;
9
+ /** Renders a button's or link's label, after its icon. */
10
+ label?: Snippet<[ToolbarButtonItem | ToolbarLinkItem]> | undefined;
11
+ }
12
+ declare const ToolbarItem: import("svelte").Component<ToolbarItemNodeProps, {}, "">;
13
+ type ToolbarItem = ReturnType<typeof ToolbarItem>;
14
+ export default ToolbarItem;
@@ -0,0 +1,74 @@
1
+ <script module lang="ts">
2
+ // @stable — follows semver.
3
+ import type { Snippet } from "svelte";
4
+ import type {
5
+ PrimitiveToolbarApi,
6
+ PrimitiveToolbarOptions,
7
+ ToolbarButtonItem,
8
+ ToolbarLinkItem,
9
+ } from "@bevelo/core";
10
+ import type { PrimitiveProps } from "./props.js";
11
+
12
+ /** Props for `Toolbar`. */
13
+ export interface ToolbarProps
14
+ extends PrimitiveProps<
15
+ PrimitiveToolbarOptions,
16
+ {
17
+ /** Renders a button's or link's label after its icon; the label text when left out. */
18
+ item?: Snippet<[ToolbarButtonItem | ToolbarLinkItem]> | undefined;
19
+ },
20
+ HTMLDivElement
21
+ > {}
22
+
23
+ /** A toolbar's imperative handle: the primitive's api plus `focus()`. */
24
+ export type ToolbarApi = PrimitiveToolbarApi & {
25
+ /** Moves focus to the entry that holds the tab stop. */
26
+ focus(): void;
27
+ };
28
+ </script>
29
+
30
+ <script lang="ts">
31
+ // The Svelte adapter for `Toolbar` on the headless path: the primitive owns
32
+ // the roving tab stop and the arrow-key machine; the registry (core's roving
33
+ // focus binding) turns the tab stop into real focus; Svelte owns the row.
34
+ import { toolbarPrimitive } from "@bevelo/core";
35
+ import type { PrimitivePart, ToolbarItem } from "@bevelo/core";
36
+ import { usePrimitive, partProps, splitOptions } from "./headless.svelte.js";
37
+ import ToolbarItemNode from "./toolbar-item.svelte";
38
+
39
+ const NO_ITEMS: readonly ToolbarItem[] = [];
40
+
41
+ let { item, ...rest }: ToolbarProps = $props();
42
+
43
+ const split = $derived(splitOptions(toolbarPrimitive, rest));
44
+ const _uid = $props.id();
45
+ const handle = usePrimitive(toolbarPrimitive, () => ({
46
+ ...split.options,
47
+ items: split.options.items ?? NO_ITEMS,
48
+ }), _uid);
49
+
50
+ const toolbarApi: ToolbarApi = {
51
+ get activeValue() {
52
+ return handle.api.activeValue;
53
+ },
54
+ focusItem: (value) => handle.api.focusItem(value),
55
+ trackFocus: (value) => handle.api.trackFocus(value),
56
+ focus: () => handle.api.focusItem(handle.api.activeValue),
57
+ };
58
+
59
+ /** The toolbar's api: `focus`, `focusItem`, `trackFocus` and `activeValue`. */
60
+ export function api(): ToolbarApi {
61
+ return toolbarApi;
62
+ }
63
+
64
+ function partOf(name: string, scope: string): PrimitivePart | undefined {
65
+ return handle.part(name, { scope });
66
+ }
67
+
68
+ const root = $derived(handle.part("root"));
69
+ const rows = $derived(split.options.items ?? NO_ITEMS);
70
+ </script>
71
+
72
+ {#if root}
73
+ <svelte:element this={root.tag} {...partProps(root, split.attrs)}>{#each rows as entry (entry.value)}<ToolbarItemNode item={entry} {partOf} label={item} />{/each}</svelte:element>
74
+ {/if}
@@ -0,0 +1,19 @@
1
+ import type { Snippet } from "svelte";
2
+ import type { PrimitiveToolbarApi, PrimitiveToolbarOptions, ToolbarButtonItem, ToolbarLinkItem } from "@bevelo/core";
3
+ import type { PrimitiveProps } from "./props.js";
4
+ /** Props for `Toolbar`. */
5
+ export interface ToolbarProps extends PrimitiveProps<PrimitiveToolbarOptions, {
6
+ /** Renders a button's or link's label after its icon; the label text when left out. */
7
+ item?: Snippet<[ToolbarButtonItem | ToolbarLinkItem]> | undefined;
8
+ }, HTMLDivElement> {
9
+ }
10
+ /** A toolbar's imperative handle: the primitive's api plus `focus()`. */
11
+ export type ToolbarApi = PrimitiveToolbarApi & {
12
+ /** Moves focus to the entry that holds the tab stop. */
13
+ focus(): void;
14
+ };
15
+ declare const Toolbar: import("svelte").Component<ToolbarProps, {
16
+ api: () => ToolbarApi;
17
+ }, "">;
18
+ type Toolbar = ReturnType<typeof Toolbar>;
19
+ export default Toolbar;