@thomasfosterau/components 0.0.0 → 0.2.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 (484) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +241 -56
  3. package/dist/canvas/VectorCanvas.svelte +320 -0
  4. package/dist/canvas/VectorCanvas.svelte.d.ts +105 -0
  5. package/dist/canvas/history.d.ts +105 -0
  6. package/dist/canvas/history.js +147 -0
  7. package/dist/canvas/index.d.ts +15 -0
  8. package/dist/canvas/index.js +14 -0
  9. package/dist/canvas/types.d.ts +91 -0
  10. package/dist/canvas/types.js +13 -0
  11. package/dist/canvas/utils.d.ts +66 -0
  12. package/dist/canvas/utils.js +114 -0
  13. package/dist/charts/Chart.svelte +300 -0
  14. package/dist/charts/Chart.svelte.d.ts +50 -0
  15. package/dist/charts/index.d.ts +11 -0
  16. package/dist/charts/index.js +10 -0
  17. package/dist/charts/types.d.ts +28 -0
  18. package/dist/charts/types.js +6 -0
  19. package/dist/citations/BookCitation.svelte +53 -0
  20. package/dist/citations/BookCitation.svelte.d.ts +41 -0
  21. package/dist/citations/ChapterCitation.svelte +38 -0
  22. package/dist/citations/ChapterCitation.svelte.d.ts +50 -0
  23. package/dist/citations/Citation.svelte +47 -0
  24. package/dist/citations/Citation.svelte.d.ts +24 -0
  25. package/dist/citations/CreditList.svelte +69 -0
  26. package/dist/citations/CreditList.svelte.d.ts +47 -0
  27. package/dist/citations/DOILink.svelte +28 -0
  28. package/dist/citations/DOILink.svelte.d.ts +19 -0
  29. package/dist/citations/Footnote.svelte +39 -0
  30. package/dist/citations/Footnote.svelte.d.ts +17 -0
  31. package/dist/citations/FootnoteList.svelte +36 -0
  32. package/dist/citations/FootnoteList.svelte.d.ts +21 -0
  33. package/dist/citations/ISBNLink.svelte +29 -0
  34. package/dist/citations/ISBNLink.svelte.d.ts +19 -0
  35. package/dist/citations/ISSNLink.svelte +29 -0
  36. package/dist/citations/ISSNLink.svelte.d.ts +19 -0
  37. package/dist/citations/Publisher.svelte +34 -0
  38. package/dist/citations/Publisher.svelte.d.ts +14 -0
  39. package/dist/citations/ReferenceList.svelte +53 -0
  40. package/dist/citations/ReferenceList.svelte.d.ts +21 -0
  41. package/dist/citations/ReportCitation.svelte +41 -0
  42. package/dist/citations/ReportCitation.svelte.d.ts +36 -0
  43. package/dist/citations/ScholarlyArticleCitation.svelte +64 -0
  44. package/dist/citations/ScholarlyArticleCitation.svelte.d.ts +41 -0
  45. package/dist/citations/ThesisCitation.svelte +35 -0
  46. package/dist/citations/ThesisCitation.svelte.d.ts +29 -0
  47. package/dist/citations/bibliography.svelte.d.ts +55 -0
  48. package/dist/citations/bibliography.svelte.js +78 -0
  49. package/dist/citations/citation.d.ts +71 -0
  50. package/dist/citations/citation.js +121 -0
  51. package/dist/citations/csl.d.ts +102 -0
  52. package/dist/citations/csl.js +20 -0
  53. package/dist/citations/index.d.ts +31 -0
  54. package/dist/citations/index.js +36 -0
  55. package/dist/citations/list-format.d.ts +34 -0
  56. package/dist/citations/list-format.js +40 -0
  57. package/dist/context.svelte.d.ts +46 -0
  58. package/dist/context.svelte.js +51 -0
  59. package/dist/data/ChatBubble.svelte +48 -0
  60. package/dist/data/ChatBubble.svelte.d.ts +33 -0
  61. package/dist/data/DataGrid.svelte +150 -0
  62. package/dist/data/DataGrid.svelte.d.ts +118 -0
  63. package/dist/data/DescriptionList.svelte +53 -0
  64. package/dist/data/DescriptionList.svelte.d.ts +26 -0
  65. package/dist/data/DescriptionRow.svelte +56 -0
  66. package/dist/data/DescriptionRow.svelte.d.ts +21 -0
  67. package/dist/data/DiffText.svelte +29 -0
  68. package/dist/data/DiffText.svelte.d.ts +19 -0
  69. package/dist/data/ItemList.svelte +80 -0
  70. package/dist/data/ItemList.svelte.d.ts +52 -0
  71. package/dist/data/LinkListItem.svelte +46 -0
  72. package/dist/data/LinkListItem.svelte.d.ts +21 -0
  73. package/dist/data/MessageThread.svelte +29 -0
  74. package/dist/data/MessageThread.svelte.d.ts +17 -0
  75. package/dist/data/Pagination.svelte +136 -0
  76. package/dist/data/Pagination.svelte.d.ts +79 -0
  77. package/dist/data/PaginationFooter.svelte +42 -0
  78. package/dist/data/PaginationFooter.svelte.d.ts +61 -0
  79. package/dist/data/ResultCount.svelte +27 -0
  80. package/dist/data/ResultCount.svelte.d.ts +18 -0
  81. package/dist/data/Table.svelte +151 -0
  82. package/dist/data/Table.svelte.d.ts +75 -0
  83. package/dist/data/TreeList.svelte +41 -0
  84. package/dist/data/TreeList.svelte.d.ts +17 -0
  85. package/dist/data/TreeListItem.svelte +29 -0
  86. package/dist/data/TreeListItem.svelte.d.ts +10 -0
  87. package/dist/data/description-context.d.ts +39 -0
  88. package/dist/data/description-context.js +36 -0
  89. package/dist/data/diff.d.ts +14 -0
  90. package/dist/data/diff.js +10 -0
  91. package/dist/data/index.d.ts +37 -0
  92. package/dist/data/index.js +37 -0
  93. package/dist/data/list-item.d.ts +30 -0
  94. package/dist/data/list-item.js +19 -0
  95. package/dist/data/pagination.d.ts +81 -0
  96. package/dist/data/pagination.js +79 -0
  97. package/dist/data/table-types.d.ts +71 -0
  98. package/dist/data/table-types.js +35 -0
  99. package/dist/feedback/ConfirmDialog.svelte +79 -0
  100. package/dist/feedback/ConfirmDialog.svelte.d.ts +82 -0
  101. package/dist/feedback/Dialog.svelte +47 -0
  102. package/dist/feedback/Dialog.svelte.d.ts +36 -0
  103. package/dist/feedback/DialogFrame.svelte +64 -0
  104. package/dist/feedback/DialogFrame.svelte.d.ts +23 -0
  105. package/dist/feedback/Drawer.svelte +43 -0
  106. package/dist/feedback/Drawer.svelte.d.ts +43 -0
  107. package/dist/feedback/LoadingBoundary.svelte +61 -0
  108. package/dist/feedback/LoadingBoundary.svelte.d.ts +34 -0
  109. package/dist/feedback/ProgressBar.svelte +46 -0
  110. package/dist/feedback/ProgressBar.svelte.d.ts +28 -0
  111. package/dist/feedback/SegmentBar.svelte +83 -0
  112. package/dist/feedback/SegmentBar.svelte.d.ts +37 -0
  113. package/dist/feedback/StatTile.svelte +77 -0
  114. package/dist/feedback/StatTile.svelte.d.ts +50 -0
  115. package/dist/feedback/Stats.svelte +18 -0
  116. package/dist/feedback/Stats.svelte.d.ts +16 -0
  117. package/dist/feedback/Steps.svelte +72 -0
  118. package/dist/feedback/Steps.svelte.d.ts +61 -0
  119. package/dist/feedback/Timeline.svelte +86 -0
  120. package/dist/feedback/Timeline.svelte.d.ts +55 -0
  121. package/dist/feedback/Toaster.svelte +78 -0
  122. package/dist/feedback/Toaster.svelte.d.ts +32 -0
  123. package/dist/feedback/index.d.ts +34 -0
  124. package/dist/feedback/index.js +29 -0
  125. package/dist/feedback/sizes.d.ts +41 -0
  126. package/dist/feedback/sizes.js +69 -0
  127. package/dist/feedback/toaster.d.ts +48 -0
  128. package/dist/feedback/toaster.js +29 -0
  129. package/dist/fields/Calendar.svelte +60 -0
  130. package/dist/fields/Calendar.svelte.d.ts +11 -0
  131. package/dist/fields/CalendarMonths.svelte +86 -0
  132. package/dist/fields/CalendarMonths.svelte.d.ts +30 -0
  133. package/dist/fields/Checkbox.svelte +33 -0
  134. package/dist/fields/Checkbox.svelte.d.ts +30 -0
  135. package/dist/fields/CheckboxGroup.svelte +41 -0
  136. package/dist/fields/CheckboxGroup.svelte.d.ts +40 -0
  137. package/dist/fields/Combobox.svelte +229 -0
  138. package/dist/fields/Combobox.svelte.d.ts +133 -0
  139. package/dist/fields/DateField.svelte +37 -0
  140. package/dist/fields/DateField.svelte.d.ts +20 -0
  141. package/dist/fields/DateInput.svelte +31 -0
  142. package/dist/fields/DateInput.svelte.d.ts +35 -0
  143. package/dist/fields/DatePicker.svelte +47 -0
  144. package/dist/fields/DatePicker.svelte.d.ts +25 -0
  145. package/dist/fields/DateRangePicker.svelte +70 -0
  146. package/dist/fields/DateRangePicker.svelte.d.ts +43 -0
  147. package/dist/fields/Dropzone.svelte +232 -0
  148. package/dist/fields/Dropzone.svelte.d.ts +103 -0
  149. package/dist/fields/FieldErrors.svelte +30 -0
  150. package/dist/fields/FieldErrors.svelte.d.ts +11 -0
  151. package/dist/fields/Fieldset.svelte +53 -0
  152. package/dist/fields/Fieldset.svelte.d.ts +27 -0
  153. package/dist/fields/FileInput.svelte +68 -0
  154. package/dist/fields/FileInput.svelte.d.ts +39 -0
  155. package/dist/fields/FormField.svelte +78 -0
  156. package/dist/fields/FormField.svelte.d.ts +29 -0
  157. package/dist/fields/ImageInput.svelte +87 -0
  158. package/dist/fields/ImageInput.svelte.d.ts +45 -0
  159. package/dist/fields/MultiSelect.svelte +112 -0
  160. package/dist/fields/MultiSelect.svelte.d.ts +75 -0
  161. package/dist/fields/NumberField.svelte +190 -0
  162. package/dist/fields/NumberField.svelte.d.ts +76 -0
  163. package/dist/fields/PasswordInput.svelte +95 -0
  164. package/dist/fields/PasswordInput.svelte.d.ts +58 -0
  165. package/dist/fields/PickerPopover.svelte +47 -0
  166. package/dist/fields/PickerPopover.svelte.d.ts +16 -0
  167. package/dist/fields/PinInput.svelte +83 -0
  168. package/dist/fields/PinInput.svelte.d.ts +66 -0
  169. package/dist/fields/PushToggle.svelte +93 -0
  170. package/dist/fields/PushToggle.svelte.d.ts +55 -0
  171. package/dist/fields/RadioGroup.svelte +88 -0
  172. package/dist/fields/RadioGroup.svelte.d.ts +41 -0
  173. package/dist/fields/RangeCalendar.svelte +51 -0
  174. package/dist/fields/RangeCalendar.svelte.d.ts +23 -0
  175. package/dist/fields/Rating.svelte +127 -0
  176. package/dist/fields/Rating.svelte.d.ts +86 -0
  177. package/dist/fields/SearchInput.svelte +58 -0
  178. package/dist/fields/SearchInput.svelte.d.ts +33 -0
  179. package/dist/fields/SegmentGroup.svelte +91 -0
  180. package/dist/fields/SegmentGroup.svelte.d.ts +20 -0
  181. package/dist/fields/Select.svelte +36 -0
  182. package/dist/fields/Select.svelte.d.ts +35 -0
  183. package/dist/fields/Slider.svelte +194 -0
  184. package/dist/fields/Slider.svelte.d.ts +100 -0
  185. package/dist/fields/TagsInput.svelte +256 -0
  186. package/dist/fields/TagsInput.svelte.d.ts +102 -0
  187. package/dist/fields/TextInput.svelte +26 -0
  188. package/dist/fields/TextInput.svelte.d.ts +36 -0
  189. package/dist/fields/Textarea.svelte +22 -0
  190. package/dist/fields/Textarea.svelte.d.ts +31 -0
  191. package/dist/fields/TimeField.svelte +30 -0
  192. package/dist/fields/TimeField.svelte.d.ts +19 -0
  193. package/dist/fields/Toggle.svelte +72 -0
  194. package/dist/fields/Toggle.svelte.d.ts +38 -0
  195. package/dist/fields/VideoInput.svelte +35 -0
  196. package/dist/fields/VideoInput.svelte.d.ts +46 -0
  197. package/dist/fields/calendar-props.d.ts +119 -0
  198. package/dist/fields/calendar-props.js +51 -0
  199. package/dist/fields/dates.d.ts +28 -0
  200. package/dist/fields/dates.js +26 -0
  201. package/dist/fields/field-types.d.ts +80 -0
  202. package/dist/fields/field-types.js +92 -0
  203. package/dist/fields/file-validation.d.ts +30 -0
  204. package/dist/fields/file-validation.js +51 -0
  205. package/dist/fields/index.d.ts +43 -0
  206. package/dist/fields/index.js +42 -0
  207. package/dist/fields/latest-search.svelte.d.ts +38 -0
  208. package/dist/fields/latest-search.svelte.js +85 -0
  209. package/dist/fields/number-format.d.ts +52 -0
  210. package/dist/fields/number-format.js +89 -0
  211. package/dist/fields/segmented-field.d.ts +128 -0
  212. package/dist/fields/segmented-field.js +52 -0
  213. package/dist/fields/slider-keys.d.ts +21 -0
  214. package/dist/fields/slider-keys.js +37 -0
  215. package/dist/formatting/Countdown.svelte +110 -0
  216. package/dist/formatting/Countdown.svelte.d.ts +35 -0
  217. package/dist/formatting/DateTime.svelte +35 -0
  218. package/dist/formatting/DateTime.svelte.d.ts +26 -0
  219. package/dist/formatting/Duration.svelte +18 -0
  220. package/dist/formatting/Duration.svelte.d.ts +20 -0
  221. package/dist/formatting/FormatList.svelte +31 -0
  222. package/dist/formatting/FormatList.svelte.d.ts +46 -0
  223. package/dist/formatting/Highlight.svelte +51 -0
  224. package/dist/formatting/Highlight.svelte.d.ts +19 -0
  225. package/dist/formatting/Number.svelte +35 -0
  226. package/dist/formatting/Number.svelte.d.ts +43 -0
  227. package/dist/formatting/RelativeTime.svelte +69 -0
  228. package/dist/formatting/RelativeTime.svelte.d.ts +26 -0
  229. package/dist/formatting/Year.svelte +39 -0
  230. package/dist/formatting/Year.svelte.d.ts +21 -0
  231. package/dist/formatting/duration.d.ts +44 -0
  232. package/dist/formatting/duration.js +125 -0
  233. package/dist/formatting/index.d.ts +15 -0
  234. package/dist/formatting/index.js +17 -0
  235. package/dist/forms/EntityForm.svelte +185 -0
  236. package/dist/forms/EntityForm.svelte.d.ts +66 -0
  237. package/dist/forms/FormActions.svelte +29 -0
  238. package/dist/forms/FormActions.svelte.d.ts +37 -0
  239. package/dist/forms/FormErrors.svelte +21 -0
  240. package/dist/forms/FormErrors.svelte.d.ts +16 -0
  241. package/dist/forms/HiddenField.svelte +22 -0
  242. package/dist/forms/HiddenField.svelte.d.ts +11 -0
  243. package/dist/forms/SearchForm.svelte +43 -0
  244. package/dist/forms/SearchForm.svelte.d.ts +36 -0
  245. package/dist/forms/entity-form.d.ts +12 -0
  246. package/dist/forms/entity-form.js +12 -0
  247. package/dist/forms/index.d.ts +14 -0
  248. package/dist/forms/index.js +14 -0
  249. package/dist/hotkeys/HotkeyBadge.svelte +39 -0
  250. package/dist/hotkeys/HotkeyBadge.svelte.d.ts +25 -0
  251. package/dist/hotkeys/HotkeyHelpDialog.svelte +68 -0
  252. package/dist/hotkeys/HotkeyHelpDialog.svelte.d.ts +35 -0
  253. package/dist/hotkeys/HotkeyProvider.svelte +92 -0
  254. package/dist/hotkeys/HotkeyProvider.svelte.d.ts +4 -0
  255. package/dist/hotkeys/context.svelte.d.ts +47 -0
  256. package/dist/hotkeys/context.svelte.js +72 -0
  257. package/dist/hotkeys/index.d.ts +28 -0
  258. package/dist/hotkeys/index.js +27 -0
  259. package/dist/hotkeys/match.d.ts +65 -0
  260. package/dist/hotkeys/match.js +135 -0
  261. package/dist/hotkeys/registry.svelte.d.ts +55 -0
  262. package/dist/hotkeys/registry.svelte.js +110 -0
  263. package/dist/hotkeys/types.d.ts +74 -0
  264. package/dist/hotkeys/types.js +18 -0
  265. package/dist/index.d.ts +37 -0
  266. package/dist/index.js +37 -0
  267. package/dist/infobox/Infobox.svelte +79 -0
  268. package/dist/infobox/Infobox.svelte.d.ts +33 -0
  269. package/dist/infobox/InfoboxHeader.svelte +35 -0
  270. package/dist/infobox/InfoboxHeader.svelte.d.ts +18 -0
  271. package/dist/infobox/InfoboxImage.svelte +38 -0
  272. package/dist/infobox/InfoboxImage.svelte.d.ts +21 -0
  273. package/dist/infobox/InfoboxRow.svelte +50 -0
  274. package/dist/infobox/InfoboxRow.svelte.d.ts +25 -0
  275. package/dist/infobox/InfoboxSection.svelte +24 -0
  276. package/dist/infobox/InfoboxSection.svelte.d.ts +12 -0
  277. package/dist/infobox/index.d.ts +21 -0
  278. package/dist/infobox/index.js +20 -0
  279. package/dist/infobox/types.d.ts +86 -0
  280. package/dist/infobox/types.js +27 -0
  281. package/dist/layout/AppShell.svelte +50 -0
  282. package/dist/layout/AppShell.svelte.d.ts +28 -0
  283. package/dist/layout/Breadcrumbs.svelte +52 -0
  284. package/dist/layout/Breadcrumbs.svelte.d.ts +18 -0
  285. package/dist/layout/Cluster.svelte +28 -0
  286. package/dist/layout/Cluster.svelte.d.ts +27 -0
  287. package/dist/layout/DetailLayout.svelte +50 -0
  288. package/dist/layout/DetailLayout.svelte.d.ts +19 -0
  289. package/dist/layout/FilterBar.svelte +40 -0
  290. package/dist/layout/FilterBar.svelte.d.ts +12 -0
  291. package/dist/layout/Fits.svelte +27 -0
  292. package/dist/layout/Fits.svelte.d.ts +13 -0
  293. package/dist/layout/Flow.svelte +46 -0
  294. package/dist/layout/Flow.svelte.d.ts +16 -0
  295. package/dist/layout/Footer.svelte +32 -0
  296. package/dist/layout/Footer.svelte.d.ts +12 -0
  297. package/dist/layout/Grid.svelte +23 -0
  298. package/dist/layout/Grid.svelte.d.ts +26 -0
  299. package/dist/layout/HStack.svelte +12 -0
  300. package/dist/layout/HStack.svelte.d.ts +34 -0
  301. package/dist/layout/Hero.svelte +76 -0
  302. package/dist/layout/Hero.svelte.d.ts +36 -0
  303. package/dist/layout/Main.svelte +30 -0
  304. package/dist/layout/Main.svelte.d.ts +15 -0
  305. package/dist/layout/Navbar.svelte +68 -0
  306. package/dist/layout/Navbar.svelte.d.ts +31 -0
  307. package/dist/layout/PageHeader.svelte +77 -0
  308. package/dist/layout/PageHeader.svelte.d.ts +33 -0
  309. package/dist/layout/Section.svelte +72 -0
  310. package/dist/layout/Section.svelte.d.ts +40 -0
  311. package/dist/layout/Sidebar.svelte +54 -0
  312. package/dist/layout/Sidebar.svelte.d.ts +27 -0
  313. package/dist/layout/Spacer.svelte +12 -0
  314. package/dist/layout/Spacer.svelte.d.ts +6 -0
  315. package/dist/layout/Tabs.svelte +85 -0
  316. package/dist/layout/Tabs.svelte.d.ts +42 -0
  317. package/dist/layout/VStack.svelte +12 -0
  318. package/dist/layout/VStack.svelte.d.ts +29 -0
  319. package/dist/layout/index.d.ts +38 -0
  320. package/dist/layout/index.js +38 -0
  321. package/dist/layout/space.d.ts +44 -0
  322. package/dist/layout/space.js +76 -0
  323. package/dist/layout/types.d.ts +52 -0
  324. package/dist/layout/types.js +27 -0
  325. package/dist/links/ContextLinks.svelte +28 -0
  326. package/dist/links/ContextLinks.svelte.d.ts +20 -0
  327. package/dist/links/EmailLink.svelte +26 -0
  328. package/dist/links/EmailLink.svelte.d.ts +20 -0
  329. package/dist/links/index.d.ts +7 -0
  330. package/dist/links/index.js +7 -0
  331. package/dist/media/Figure.svelte +26 -0
  332. package/dist/media/Figure.svelte.d.ts +12 -0
  333. package/dist/media/Image.svelte +76 -0
  334. package/dist/media/Image.svelte.d.ts +41 -0
  335. package/dist/media/Video.svelte +65 -0
  336. package/dist/media/Video.svelte.d.ts +29 -0
  337. package/dist/media/image-dimensions.d.ts +28 -0
  338. package/dist/media/image-dimensions.js +34 -0
  339. package/dist/media/index.d.ts +10 -0
  340. package/dist/media/index.js +10 -0
  341. package/dist/search/CommandPalette.svelte +257 -0
  342. package/dist/search/CommandPalette.svelte.d.ts +59 -0
  343. package/dist/search/index.d.ts +13 -0
  344. package/dist/search/index.js +13 -0
  345. package/dist/search/types.d.ts +40 -0
  346. package/dist/search/types.js +20 -0
  347. package/dist/seo/Head.svelte +190 -0
  348. package/dist/seo/Head.svelte.d.ts +86 -0
  349. package/dist/seo/JsonLd.svelte +30 -0
  350. package/dist/seo/JsonLd.svelte.d.ts +20 -0
  351. package/dist/seo/index.d.ts +18 -0
  352. package/dist/seo/index.js +17 -0
  353. package/dist/seo/json-ld.d.ts +33 -0
  354. package/dist/seo/json-ld.js +29 -0
  355. package/dist/seo/og-image.d.ts +72 -0
  356. package/dist/seo/og-image.js +82 -0
  357. package/dist/seo/types.d.ts +43 -0
  358. package/dist/seo/types.js +6 -0
  359. package/dist/theme.css +161 -0
  360. package/dist/tips/PopoverTip.svelte +80 -0
  361. package/dist/tips/PopoverTip.svelte.d.ts +33 -0
  362. package/dist/tips/Tip.svelte +91 -0
  363. package/dist/tips/Tip.svelte.d.ts +25 -0
  364. package/dist/tips/index.d.ts +15 -0
  365. package/dist/tips/index.js +14 -0
  366. package/dist/tips/tip-stack.d.ts +26 -0
  367. package/dist/tips/tip-stack.js +37 -0
  368. package/dist/tips/tip-store.svelte.d.ts +75 -0
  369. package/dist/tips/tip-store.svelte.js +158 -0
  370. package/dist/tips/types.d.ts +46 -0
  371. package/dist/tips/types.js +6 -0
  372. package/dist/ui/Accordion.svelte +75 -0
  373. package/dist/ui/Accordion.svelte.d.ts +50 -0
  374. package/dist/ui/AccordionItem.svelte +73 -0
  375. package/dist/ui/AccordionItem.svelte.d.ts +18 -0
  376. package/dist/ui/Alert.svelte +61 -0
  377. package/dist/ui/Alert.svelte.d.ts +37 -0
  378. package/dist/ui/Badge.svelte +39 -0
  379. package/dist/ui/Badge.svelte.d.ts +32 -0
  380. package/dist/ui/Button.svelte +44 -0
  381. package/dist/ui/Button.svelte.d.ts +29 -0
  382. package/dist/ui/ButtonGroup.svelte +24 -0
  383. package/dist/ui/ButtonGroup.svelte.d.ts +17 -0
  384. package/dist/ui/Card.svelte +49 -0
  385. package/dist/ui/Card.svelte.d.ts +44 -0
  386. package/dist/ui/Chip.svelte +58 -0
  387. package/dist/ui/Chip.svelte.d.ts +21 -0
  388. package/dist/ui/ConfirmButton.svelte +75 -0
  389. package/dist/ui/ConfirmButton.svelte.d.ts +48 -0
  390. package/dist/ui/ContextMenu.svelte +75 -0
  391. package/dist/ui/ContextMenu.svelte.d.ts +25 -0
  392. package/dist/ui/Disclosure.svelte +46 -0
  393. package/dist/ui/Disclosure.svelte.d.ts +22 -0
  394. package/dist/ui/Divider.svelte +47 -0
  395. package/dist/ui/Divider.svelte.d.ts +28 -0
  396. package/dist/ui/DropdownMenu.svelte +44 -0
  397. package/dist/ui/DropdownMenu.svelte.d.ts +30 -0
  398. package/dist/ui/EmptyState.svelte +37 -0
  399. package/dist/ui/EmptyState.svelte.d.ts +22 -0
  400. package/dist/ui/ExternalLink.svelte +38 -0
  401. package/dist/ui/ExternalLink.svelte.d.ts +34 -0
  402. package/dist/ui/Heading.svelte +58 -0
  403. package/dist/ui/Heading.svelte.d.ts +22 -0
  404. package/dist/ui/Link.svelte +34 -0
  405. package/dist/ui/Link.svelte.d.ts +20 -0
  406. package/dist/ui/LinkButton.svelte +51 -0
  407. package/dist/ui/LinkButton.svelte.d.ts +33 -0
  408. package/dist/ui/Menu.svelte +24 -0
  409. package/dist/ui/Menu.svelte.d.ts +13 -0
  410. package/dist/ui/MenuCheckboxItem.svelte +33 -0
  411. package/dist/ui/MenuCheckboxItem.svelte.d.ts +20 -0
  412. package/dist/ui/MenuItem.svelte +73 -0
  413. package/dist/ui/MenuItem.svelte.d.ts +21 -0
  414. package/dist/ui/MenuRadioGroup.svelte +25 -0
  415. package/dist/ui/MenuRadioGroup.svelte.d.ts +20 -0
  416. package/dist/ui/MenuRadioItem.svelte +20 -0
  417. package/dist/ui/MenuRadioItem.svelte.d.ts +15 -0
  418. package/dist/ui/MenuSeparator.svelte +27 -0
  419. package/dist/ui/MenuSeparator.svelte.d.ts +8 -0
  420. package/dist/ui/MenuSub.svelte +24 -0
  421. package/dist/ui/MenuSub.svelte.d.ts +15 -0
  422. package/dist/ui/Popover.svelte +63 -0
  423. package/dist/ui/Popover.svelte.d.ts +40 -0
  424. package/dist/ui/ShareButton.svelte +64 -0
  425. package/dist/ui/ShareButton.svelte.d.ts +39 -0
  426. package/dist/ui/Skeleton.svelte +43 -0
  427. package/dist/ui/Skeleton.svelte.d.ts +22 -0
  428. package/dist/ui/Spinner.svelte +41 -0
  429. package/dist/ui/Spinner.svelte.d.ts +35 -0
  430. package/dist/ui/Stack.svelte +36 -0
  431. package/dist/ui/Stack.svelte.d.ts +48 -0
  432. package/dist/ui/ThemeToggle.svelte +65 -0
  433. package/dist/ui/ThemeToggle.svelte.d.ts +24 -0
  434. package/dist/ui/ToggleButton.svelte +58 -0
  435. package/dist/ui/ToggleButton.svelte.d.ts +45 -0
  436. package/dist/ui/ToggleGroup.svelte +142 -0
  437. package/dist/ui/ToggleGroup.svelte.d.ts +86 -0
  438. package/dist/ui/Toolbar.svelte +40 -0
  439. package/dist/ui/Toolbar.svelte.d.ts +20 -0
  440. package/dist/ui/ToolbarButton.svelte +29 -0
  441. package/dist/ui/ToolbarButton.svelte.d.ts +21 -0
  442. package/dist/ui/ToolbarLink.svelte +21 -0
  443. package/dist/ui/ToolbarLink.svelte.d.ts +12 -0
  444. package/dist/ui/ToolbarSeparator.svelte +22 -0
  445. package/dist/ui/ToolbarSeparator.svelte.d.ts +12 -0
  446. package/dist/ui/ToolbarToggleGroup.svelte +66 -0
  447. package/dist/ui/ToolbarToggleGroup.svelte.d.ts +52 -0
  448. package/dist/ui/Tooltip.svelte +54 -0
  449. package/dist/ui/Tooltip.svelte.d.ts +35 -0
  450. package/dist/ui/VisuallyHidden.svelte +23 -0
  451. package/dist/ui/VisuallyHidden.svelte.d.ts +10 -0
  452. package/dist/ui/accordion-context.d.ts +26 -0
  453. package/dist/ui/accordion-context.js +23 -0
  454. package/dist/ui/colour-token.d.ts +41 -0
  455. package/dist/ui/colour-token.js +49 -0
  456. package/dist/ui/context-menu.d.ts +13 -0
  457. package/dist/ui/context-menu.js +13 -0
  458. package/dist/ui/index.d.ts +63 -0
  459. package/dist/ui/index.js +62 -0
  460. package/dist/ui/menu-context.d.ts +20 -0
  461. package/dist/ui/menu-context.js +22 -0
  462. package/dist/ui/menu-parts/CheckboxItemPart.svelte +26 -0
  463. package/dist/ui/menu-parts/CheckboxItemPart.svelte.d.ts +5 -0
  464. package/dist/ui/menu-parts/ItemPart.svelte +29 -0
  465. package/dist/ui/menu-parts/ItemPart.svelte.d.ts +5 -0
  466. package/dist/ui/menu-parts/RadioGroupPart.svelte +24 -0
  467. package/dist/ui/menu-parts/RadioGroupPart.svelte.d.ts +5 -0
  468. package/dist/ui/menu-parts/RadioItemPart.svelte +22 -0
  469. package/dist/ui/menu-parts/RadioItemPart.svelte.d.ts +5 -0
  470. package/dist/ui/menu-parts/SeparatorPart.svelte +16 -0
  471. package/dist/ui/menu-parts/SeparatorPart.svelte.d.ts +5 -0
  472. package/dist/ui/menu-parts/SubPart.svelte +28 -0
  473. package/dist/ui/menu-parts/SubPart.svelte.d.ts +5 -0
  474. package/dist/ui/menu-parts/menu-parts.d.ts +104 -0
  475. package/dist/ui/menu-parts/menu-parts.js +31 -0
  476. package/dist/ui/menu-parts/parts.d.ts +12 -0
  477. package/dist/ui/menu-parts/parts.js +27 -0
  478. package/dist/ui/slug.d.ts +19 -0
  479. package/dist/ui/slug.js +25 -0
  480. package/dist/ui/toggle-classes.d.ts +39 -0
  481. package/dist/ui/toggle-classes.js +36 -0
  482. package/dist/ui/tones.d.ts +103 -0
  483. package/dist/ui/tones.js +240 -0
  484. package/package.json +41 -25
@@ -0,0 +1,49 @@
1
+ /**
2
+ * The colour-token indirection: how a component takes a colour it does not
3
+ * own.
4
+ *
5
+ * Some things are coloured by their subject rather than by a semantic tone —
6
+ * a political party, a taxon rank, a project label. The colour belongs to the
7
+ * consuming application, not to this library, and it is never an inline hex
8
+ * here: the app's theme declares one custom property per subject
9
+ * (`--party-alp`, `--rank-genus`, …) in **both** its light and dark themes,
10
+ * and hands a component the property's NAME.
11
+ *
12
+ * The helpers below turn that name into the single custom property the
13
+ * component's Tailwind classes read (`bg-(--badge-colour)`,
14
+ * `border-(--chip-colour)`), with the theme's `neutral` colour as the
15
+ * fallback for a token the theme has no entry for. The only inline style
16
+ * any component in this package emits is that one variable indirection —
17
+ * the colour value itself stays in the stylesheet.
18
+ *
19
+ * @module
20
+ */
21
+ /** The custom property {@link Badge} binds a `colourToken` to. */
22
+ export const BADGE_COLOUR_PROPERTY = '--badge-colour';
23
+ /** The custom property {@link Chip} binds a `colourToken` to. */
24
+ export const CHIP_COLOUR_PROPERTY = '--chip-colour';
25
+ /** A valid CSS custom-property name: `--` then idents, and nothing else. */
26
+ const CUSTOM_PROPERTY = /^--[a-z0-9_-]+$/i;
27
+ /**
28
+ * The inline `style` binding `property` to the theme token `token`, falling
29
+ * back to `--color-neutral` when the theme declares no such token.
30
+ *
31
+ * `token` is validated rather than trusted: a value that is not a custom
32
+ * property name is dropped entirely, so nothing a caller passes can break out
33
+ * of the `var()` it is interpolated into and inject further declarations.
34
+ *
35
+ * Returns `undefined` when there is no token, so a component can hand the
36
+ * result straight to `style` and emit no attribute at all.
37
+ *
38
+ * ```svelte
39
+ * <span style={colourTokenStyle(BADGE_COLOUR_PROPERTY, '--party-alp')}
40
+ * class="bg-(--badge-colour)/15 border-(--badge-colour)">…</span>
41
+ * ```
42
+ */
43
+ export function colourTokenStyle(property, token) {
44
+ if (token === undefined)
45
+ return undefined;
46
+ const name = token.trim();
47
+ const safe = CUSTOM_PROPERTY.test(name) ? name : '--color-neutral';
48
+ return `${property}: var(${safe}, var(--color-neutral))`;
49
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * `@thomasfosterau/components/context-menu` — the right-click / long-press
3
+ * menu, kept out of the root barrel so bits-ui's menu runtime loads only on
4
+ * the pages that use it.
5
+ *
6
+ * Its children (`MenuItem`, `MenuSeparator`, `MenuCheckboxItem`,
7
+ * `MenuRadioGroup`, `MenuRadioItem`, `MenuSub`) come from the root barrel,
8
+ * which carries no bits-ui menu code: `ContextMenu` lends them its parts
9
+ * through context.
10
+ *
11
+ * @module
12
+ */
13
+ export { default as ContextMenu } from './ContextMenu.svelte';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * `@thomasfosterau/components/context-menu` — the right-click / long-press
3
+ * menu, kept out of the root barrel so bits-ui's menu runtime loads only on
4
+ * the pages that use it.
5
+ *
6
+ * Its children (`MenuItem`, `MenuSeparator`, `MenuCheckboxItem`,
7
+ * `MenuRadioGroup`, `MenuRadioItem`, `MenuSub`) come from the root barrel,
8
+ * which carries no bits-ui menu code: `ContextMenu` lends them its parts
9
+ * through context.
10
+ *
11
+ * @module
12
+ */
13
+ export { default as ContextMenu } from './ContextMenu.svelte';
@@ -0,0 +1,63 @@
1
+ /**
2
+ * ui — buttons, badges, surfaces and small interactive affordances.
3
+ *
4
+ * The family every other family builds on: `Alert` is what a form's errors
5
+ * surface in, `Card` is the surface a section is drawn on, `Button` is what
6
+ * a dialog's actions are. Import from the package barrel rather than from
7
+ * here — this file is the family's own index, and the public surface is
8
+ * `src/lib/index.ts`.
9
+ *
10
+ * One convention worth stating once: every optional prop in this family is
11
+ * declared `T | undefined`, not bare `T`. The workspace compiles with
12
+ * `exactOptionalPropertyTypes`, under which `prop?: T` rejects an explicitly
13
+ * passed `undefined` — so a caller forwarding its own optional prop
14
+ * (`<Button {tone}>` where `tone?: Tone`) would not compile. Widening the
15
+ * declaration is what makes these primitives composable by the other
16
+ * families.
17
+ *
18
+ * @module
19
+ */
20
+ export { default as Accordion } from './Accordion.svelte';
21
+ export { default as AccordionItem } from './AccordionItem.svelte';
22
+ export { default as Alert } from './Alert.svelte';
23
+ export { default as Badge } from './Badge.svelte';
24
+ export { default as Button } from './Button.svelte';
25
+ export { default as ButtonGroup } from './ButtonGroup.svelte';
26
+ export { default as Card } from './Card.svelte';
27
+ export { default as Chip } from './Chip.svelte';
28
+ export { default as ConfirmButton } from './ConfirmButton.svelte';
29
+ export { default as Disclosure } from './Disclosure.svelte';
30
+ export { default as Divider } from './Divider.svelte';
31
+ export { default as DropdownMenu } from './DropdownMenu.svelte';
32
+ export { default as EmptyState } from './EmptyState.svelte';
33
+ export { default as ExternalLink } from './ExternalLink.svelte';
34
+ export { default as Heading } from './Heading.svelte';
35
+ export { default as Link } from './Link.svelte';
36
+ export { default as LinkButton } from './LinkButton.svelte';
37
+ export { default as Menu } from './Menu.svelte';
38
+ export { default as MenuCheckboxItem } from './MenuCheckboxItem.svelte';
39
+ export { default as MenuItem } from './MenuItem.svelte';
40
+ export { default as MenuRadioGroup } from './MenuRadioGroup.svelte';
41
+ export { default as MenuRadioItem } from './MenuRadioItem.svelte';
42
+ export { default as MenuSeparator } from './MenuSeparator.svelte';
43
+ export { default as MenuSub } from './MenuSub.svelte';
44
+ export { default as Popover } from './Popover.svelte';
45
+ export { default as ShareButton } from './ShareButton.svelte';
46
+ export { default as Skeleton } from './Skeleton.svelte';
47
+ export { default as Spinner } from './Spinner.svelte';
48
+ export { default as Stack } from './Stack.svelte';
49
+ export { default as ThemeToggle } from './ThemeToggle.svelte';
50
+ export { default as ToggleButton } from './ToggleButton.svelte';
51
+ export { default as ToggleGroup } from './ToggleGroup.svelte';
52
+ export { default as Toolbar } from './Toolbar.svelte';
53
+ export { default as ToolbarButton } from './ToolbarButton.svelte';
54
+ export { default as ToolbarLink } from './ToolbarLink.svelte';
55
+ export { default as ToolbarSeparator } from './ToolbarSeparator.svelte';
56
+ export { default as ToolbarToggleGroup } from './ToolbarToggleGroup.svelte';
57
+ export { default as Tooltip } from './Tooltip.svelte';
58
+ export { default as VisuallyHidden } from './VisuallyHidden.svelte';
59
+ export * from './colour-token.ts';
60
+ export * from './menu-context.ts';
61
+ export * from './slug.ts';
62
+ export * from './tones.ts';
63
+ export type { ToggleGroupItem } from './toggle-classes.ts';
@@ -0,0 +1,62 @@
1
+ /**
2
+ * ui — buttons, badges, surfaces and small interactive affordances.
3
+ *
4
+ * The family every other family builds on: `Alert` is what a form's errors
5
+ * surface in, `Card` is the surface a section is drawn on, `Button` is what
6
+ * a dialog's actions are. Import from the package barrel rather than from
7
+ * here — this file is the family's own index, and the public surface is
8
+ * `src/lib/index.ts`.
9
+ *
10
+ * One convention worth stating once: every optional prop in this family is
11
+ * declared `T | undefined`, not bare `T`. The workspace compiles with
12
+ * `exactOptionalPropertyTypes`, under which `prop?: T` rejects an explicitly
13
+ * passed `undefined` — so a caller forwarding its own optional prop
14
+ * (`<Button {tone}>` where `tone?: Tone`) would not compile. Widening the
15
+ * declaration is what makes these primitives composable by the other
16
+ * families.
17
+ *
18
+ * @module
19
+ */
20
+ export { default as Accordion } from './Accordion.svelte';
21
+ export { default as AccordionItem } from './AccordionItem.svelte';
22
+ export { default as Alert } from './Alert.svelte';
23
+ export { default as Badge } from './Badge.svelte';
24
+ export { default as Button } from './Button.svelte';
25
+ export { default as ButtonGroup } from './ButtonGroup.svelte';
26
+ export { default as Card } from './Card.svelte';
27
+ export { default as Chip } from './Chip.svelte';
28
+ export { default as ConfirmButton } from './ConfirmButton.svelte';
29
+ export { default as Disclosure } from './Disclosure.svelte';
30
+ export { default as Divider } from './Divider.svelte';
31
+ export { default as DropdownMenu } from './DropdownMenu.svelte';
32
+ export { default as EmptyState } from './EmptyState.svelte';
33
+ export { default as ExternalLink } from './ExternalLink.svelte';
34
+ export { default as Heading } from './Heading.svelte';
35
+ export { default as Link } from './Link.svelte';
36
+ export { default as LinkButton } from './LinkButton.svelte';
37
+ export { default as Menu } from './Menu.svelte';
38
+ export { default as MenuCheckboxItem } from './MenuCheckboxItem.svelte';
39
+ export { default as MenuItem } from './MenuItem.svelte';
40
+ export { default as MenuRadioGroup } from './MenuRadioGroup.svelte';
41
+ export { default as MenuRadioItem } from './MenuRadioItem.svelte';
42
+ export { default as MenuSeparator } from './MenuSeparator.svelte';
43
+ export { default as MenuSub } from './MenuSub.svelte';
44
+ export { default as Popover } from './Popover.svelte';
45
+ export { default as ShareButton } from './ShareButton.svelte';
46
+ export { default as Skeleton } from './Skeleton.svelte';
47
+ export { default as Spinner } from './Spinner.svelte';
48
+ export { default as Stack } from './Stack.svelte';
49
+ export { default as ThemeToggle } from './ThemeToggle.svelte';
50
+ export { default as ToggleButton } from './ToggleButton.svelte';
51
+ export { default as ToggleGroup } from './ToggleGroup.svelte';
52
+ export { default as Toolbar } from './Toolbar.svelte';
53
+ export { default as ToolbarButton } from './ToolbarButton.svelte';
54
+ export { default as ToolbarLink } from './ToolbarLink.svelte';
55
+ export { default as ToolbarSeparator } from './ToolbarSeparator.svelte';
56
+ export { default as ToolbarToggleGroup } from './ToolbarToggleGroup.svelte';
57
+ export { default as Tooltip } from './Tooltip.svelte';
58
+ export { default as VisuallyHidden } from './VisuallyHidden.svelte';
59
+ export * from "./colour-token.js";
60
+ export * from "./menu-context.js";
61
+ export * from "./slug.js";
62
+ export * from "./tones.js";
@@ -0,0 +1,20 @@
1
+ /**
2
+ * How a {@link MenuItem} learns which kind of menu it is inside.
3
+ *
4
+ * A `MenuItem` renders entirely different markup in a `DropdownMenu` or a
5
+ * `ContextMenu` — a bits-ui menu item with roving focus and typeahead — and
6
+ * in a `Menu` or a hand-assembled list, where it is a plain anchor in a
7
+ * `<ul class="menu">` navigation list. A call site writes the same
8
+ * `<MenuItem>` either way. The mode is never a prop: it is which menu
9
+ * encloses the item, so a caller can never get the two out of step.
10
+ *
11
+ * `DropdownMenu` and `ContextMenu` are the only components that import
12
+ * bits-ui's menus, and they lend the item parts to their descendants through
13
+ * context, so a navigation-only `Menu` never loads the menu runtime (#129).
14
+ *
15
+ * @module
16
+ */
17
+ /** Which kind of menu an item is inside: a dropdown, a context menu or a navigation list. */
18
+ export type MenuMode = 'dropdown' | 'context' | 'nav';
19
+ /** The enclosing menu's mode: `dropdown` or `context` inside a bits-ui menu, otherwise `nav`. */
20
+ export declare function getMenuMode(): () => MenuMode;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * How a {@link MenuItem} learns which kind of menu it is inside.
3
+ *
4
+ * A `MenuItem` renders entirely different markup in a `DropdownMenu` or a
5
+ * `ContextMenu` — a bits-ui menu item with roving focus and typeahead — and
6
+ * in a `Menu` or a hand-assembled list, where it is a plain anchor in a
7
+ * `<ul class="menu">` navigation list. A call site writes the same
8
+ * `<MenuItem>` either way. The mode is never a prop: it is which menu
9
+ * encloses the item, so a caller can never get the two out of step.
10
+ *
11
+ * `DropdownMenu` and `ContextMenu` are the only components that import
12
+ * bits-ui's menus, and they lend the item parts to their descendants through
13
+ * context, so a navigation-only `Menu` never loads the menu runtime (#129).
14
+ *
15
+ * @module
16
+ */
17
+ import { getMenuParts } from "./menu-parts/menu-parts.js";
18
+ /** The enclosing menu's mode: `dropdown` or `context` inside a bits-ui menu, otherwise `nav`. */
19
+ export function getMenuMode() {
20
+ const mode = getMenuParts()?.kind ?? 'nav';
21
+ return () => mode;
22
+ }
@@ -0,0 +1,26 @@
1
+ <!-- @component
2
+ Internal: the bits-ui checkbox item a `MenuCheckboxItem` renders inside a `DropdownMenu` or `ContextMenu`.
3
+ -->
4
+ <!--
5
+ bits-ui's shared `CheckboxItem` (`DropdownMenu.CheckboxItem` is
6
+ `ContextMenu.CheckboxItem`): `role="menuitemcheckbox"` with `aria-checked`,
7
+ toggled by Enter / Space or a click without closing the menu's focus
8
+ management. The check mark is drawn from bits-ui's own `checked`, so the
9
+ visual and the accessibility tree cannot disagree; it is `aria-hidden`
10
+ because `aria-checked` already says it. Lent through `menu-parts.ts`.
11
+ -->
12
+ <script lang="ts">import { Check } from "@lucide/svelte";
13
+ import { DropdownMenu } from "bits-ui";
14
+ let { checked, onCheckedChange, disabled, class: className, label } = $props();
15
+ </script>
16
+
17
+ <li role="none" class={className}>
18
+ <DropdownMenu.CheckboxItem {checked} {onCheckedChange} {disabled}>
19
+ {#snippet children({ checked: on })}
20
+ <span class="grid size-4 shrink-0 place-items-center" aria-hidden="true">
21
+ {#if on}<Check class="size-4" />{/if}
22
+ </span>
23
+ {@render label()}
24
+ {/snippet}
25
+ </DropdownMenu.CheckboxItem>
26
+ </li>
@@ -0,0 +1,5 @@
1
+ import type { CheckboxItemPartProps } from './menu-parts.ts';
2
+ /** Internal: the bits-ui checkbox item a `MenuCheckboxItem` renders inside a `DropdownMenu` or `ContextMenu`. */
3
+ declare const CheckboxItemPart: import("svelte").Component<CheckboxItemPartProps, {}, "">;
4
+ type CheckboxItemPart = ReturnType<typeof CheckboxItemPart>;
5
+ export default CheckboxItemPart;
@@ -0,0 +1,29 @@
1
+ <!-- @component
2
+ Internal: the bits-ui item a `MenuItem` renders inside a `DropdownMenu` or `ContextMenu`.
3
+ -->
4
+ <!--
5
+ Rendered through `bits-ui`'s `DropdownMenu.Item` `child` snippet, so the
6
+ element is still the caller's own `<a>` or `<button>` — carrying bits-ui's
7
+ `role="menuitem"`, its focus management and its selection handling. The
8
+ `<li>` is `role="none"` so it does not sit between `role="menu"` and
9
+ `role="menuitem"`. Lent to `MenuItem` through `menu-parts.ts`.
10
+ `DropdownMenu.Item` is bits-ui's shared `bits/menu` item, the same
11
+ component as `ContextMenu.Item`, so this part serves both menus.
12
+ -->
13
+ <script lang="ts">import { DropdownMenu } from "bits-ui";
14
+ let { href, current, disabled, onSelect, class: className, label } = $props();
15
+ </script>
16
+
17
+ <li role="none" class={className}>
18
+ <DropdownMenu.Item {disabled} {onSelect}>
19
+ {#snippet child({ props })}
20
+ {#if href === undefined}
21
+ <button {...props} type="button">{@render label()}</button>
22
+ {:else}
23
+ <a {...props} {href} aria-current={current ? 'page' : undefined}>
24
+ {@render label()}
25
+ </a>
26
+ {/if}
27
+ {/snippet}
28
+ </DropdownMenu.Item>
29
+ </li>
@@ -0,0 +1,5 @@
1
+ import type { ItemPartProps } from './menu-parts.ts';
2
+ /** Internal: the bits-ui item a `MenuItem` renders inside a `DropdownMenu` or `ContextMenu`. */
3
+ declare const ItemPart: import("svelte").Component<ItemPartProps, {}, "">;
4
+ type ItemPart = ReturnType<typeof ItemPart>;
5
+ export default ItemPart;
@@ -0,0 +1,24 @@
1
+ <!-- @component
2
+ Internal: the bits-ui radio group a `MenuRadioGroup` renders inside a `DropdownMenu` or `ContextMenu`.
3
+ -->
4
+ <!--
5
+ bits-ui's shared `RadioGroup` (`role="group"`), headed by its
6
+ `GroupHeading` when there is a `label`, which also names the group. The
7
+ `MenuRadioItem`s sit in a nested `<ul role="none">` so the markup stays a
8
+ valid list; daisyUI's nested-menu indent and rule are reset, since this is
9
+ a group, not a submenu. Lent through `menu-parts.ts`.
10
+ -->
11
+ <script lang="ts">import { DropdownMenu } from "bits-ui";
12
+ let { value, onValueChange, label, class: className, children } = $props();
13
+ </script>
14
+
15
+ <li role="none" class={className}>
16
+ <DropdownMenu.RadioGroup {value} {onValueChange}>
17
+ {#if label !== undefined}
18
+ <DropdownMenu.GroupHeading class="menu-title px-2">{label}</DropdownMenu.GroupHeading>
19
+ {/if}
20
+ <ul role="none" class="ms-0 ps-0 before:hidden">
21
+ {@render children()}
22
+ </ul>
23
+ </DropdownMenu.RadioGroup>
24
+ </li>
@@ -0,0 +1,5 @@
1
+ import type { RadioGroupPartProps } from './menu-parts.ts';
2
+ /** Internal: the bits-ui radio group a `MenuRadioGroup` renders inside a `DropdownMenu` or `ContextMenu`. */
3
+ declare const RadioGroupPart: import("svelte").Component<RadioGroupPartProps, {}, "">;
4
+ type RadioGroupPart = ReturnType<typeof RadioGroupPart>;
5
+ export default RadioGroupPart;
@@ -0,0 +1,22 @@
1
+ <!-- @component
2
+ Internal: the bits-ui radio item a `MenuRadioItem` renders inside a `DropdownMenu` or `ContextMenu`.
3
+ -->
4
+ <!--
5
+ bits-ui's shared `RadioItem`: `role="menuitemradio"` with `aria-checked`,
6
+ exclusive within its `MenuRadioGroup`. The dot is drawn from bits-ui's own
7
+ `checked` and is `aria-hidden`. Lent through `menu-parts.ts`.
8
+ -->
9
+ <script lang="ts">import { DropdownMenu } from "bits-ui";
10
+ let { value, disabled, class: className, label } = $props();
11
+ </script>
12
+
13
+ <li role="none" class={className}>
14
+ <DropdownMenu.RadioItem {value} {disabled}>
15
+ {#snippet children({ checked })}
16
+ <span class="grid size-4 shrink-0 place-items-center" aria-hidden="true">
17
+ {#if checked}<span class="bg-base-content size-2 rounded-full"></span>{/if}
18
+ </span>
19
+ {@render label()}
20
+ {/snippet}
21
+ </DropdownMenu.RadioItem>
22
+ </li>
@@ -0,0 +1,5 @@
1
+ import type { RadioItemPartProps } from './menu-parts.ts';
2
+ /** Internal: the bits-ui radio item a `MenuRadioItem` renders inside a `DropdownMenu` or `ContextMenu`. */
3
+ declare const RadioItemPart: import("svelte").Component<RadioItemPartProps, {}, "">;
4
+ type RadioItemPart = ReturnType<typeof RadioItemPart>;
5
+ export default RadioItemPart;
@@ -0,0 +1,16 @@
1
+ <!-- @component
2
+ Internal: the bits-ui separator a `MenuSeparator` renders inside a `DropdownMenu` or `ContextMenu`.
3
+ -->
4
+ <!--
5
+ bits-ui's own separator carries `role="separator"` and keeps it out of the
6
+ menu's arrow-key navigation; the `role="none"` `<li>` keeps the
7
+ presentational list item out of the accessibility tree. Lent to
8
+ `MenuSeparator` through `menu-parts.ts`.
9
+ -->
10
+ <script lang="ts">import { DropdownMenu } from "bits-ui";
11
+ let { class: className } = $props();
12
+ </script>
13
+
14
+ <li role="none">
15
+ <DropdownMenu.Separator class={['divider my-1 h-px', className]} />
16
+ </li>
@@ -0,0 +1,5 @@
1
+ import type { SeparatorPartProps } from './menu-parts.ts';
2
+ /** Internal: the bits-ui separator a `MenuSeparator` renders inside a `DropdownMenu` or `ContextMenu`. */
3
+ declare const SeparatorPart: import("svelte").Component<SeparatorPartProps, {}, "">;
4
+ type SeparatorPart = ReturnType<typeof SeparatorPart>;
5
+ export default SeparatorPart;
@@ -0,0 +1,28 @@
1
+ <!-- @component
2
+ Internal: the bits-ui submenu a `MenuSub` renders inside a `DropdownMenu` or `ContextMenu`.
3
+ -->
4
+ <!--
5
+ bits-ui's shared `Sub`: the `SubTrigger` is a `role="menuitem"` with
6
+ `aria-haspopup="menu"` that opens on → (← closes and returns to it), and
7
+ the `SubContent` is a `role="menu"` styled exactly as the parent menu's
8
+ list, with the same `role="none"` presentation layer. The chevron is
9
+ `aria-hidden`. Lent through `menu-parts.ts`.
10
+ -->
11
+ <script lang="ts">import { ChevronRight } from "@lucide/svelte";
12
+ import { DropdownMenu } from "bits-ui";
13
+ let { label, disabled, class: className, children } = $props();
14
+ </script>
15
+
16
+ <li role="none" class={className}>
17
+ <DropdownMenu.Sub>
18
+ <DropdownMenu.SubTrigger {disabled} class="flex justify-between">
19
+ <span>{label}</span>
20
+ <ChevronRight class="size-4" aria-hidden="true" />
21
+ </DropdownMenu.SubTrigger>
22
+ <DropdownMenu.SubContent class="z-50" sideOffset={4}>
23
+ <ul role="none" class="menu bg-base-100 rounded-box w-56 p-2 shadow-md">
24
+ {@render children()}
25
+ </ul>
26
+ </DropdownMenu.SubContent>
27
+ </DropdownMenu.Sub>
28
+ </li>
@@ -0,0 +1,5 @@
1
+ import type { SubPartProps } from './menu-parts.ts';
2
+ /** Internal: the bits-ui submenu a `MenuSub` renders inside a `DropdownMenu` or `ContextMenu`. */
3
+ declare const SubPart: import("svelte").Component<SubPartProps, {}, "">;
4
+ type SubPart = ReturnType<typeof SubPart>;
5
+ export default SubPart;
@@ -0,0 +1,104 @@
1
+ /**
2
+ * The bits-ui pieces a `DropdownMenu` or `ContextMenu` lends to the
3
+ * `MenuItem`, `MenuSeparator`, `MenuCheckboxItem`, `MenuRadioGroup`,
4
+ * `MenuRadioItem` and `MenuSub` inside it.
5
+ *
6
+ * Those children are written once for every kind of menu, but only the
7
+ * bits-ui menus need bits-ui's `Item` / `Separator` / `CheckboxItem` / … — and
8
+ * a static import of them would put the menu runtime (about 30 KB gzip) on
9
+ * every page that renders a plain navigation list (#129). So the parts travel
10
+ * down as context, set by `DropdownMenu` and `ContextMenu`, the only modules
11
+ * that import them. A child outside such a menu never sees them and never
12
+ * loads them.
13
+ *
14
+ * bits-ui's dropdown and context menus share these components (both re-export
15
+ * `bits/menu`'s `Item`, `Separator`, `CheckboxItem`, `RadioGroup`,
16
+ * `RadioItem` and `Sub*`), so one set of parts serves both (#157).
17
+ *
18
+ * Internal: not re-exported from the `ui` barrel.
19
+ *
20
+ * @module
21
+ */
22
+ import { type Component, type Snippet } from 'svelte';
23
+ /** What `MenuItem` hands the item part. */
24
+ export interface ItemPartProps {
25
+ /** The resolved link target; `undefined` renders a button. */
26
+ href: string | undefined;
27
+ /** Whether the item is the current page. */
28
+ current: boolean;
29
+ /** Shown but not activatable. */
30
+ disabled: boolean;
31
+ /** Called when the item is chosen. */
32
+ onSelect: () => void;
33
+ /** Extra classes on the `<li>`. */
34
+ class: string | undefined;
35
+ /** The item's label, icon included. */
36
+ label: Snippet<[]>;
37
+ }
38
+ /** What `MenuSeparator` hands the separator part. */
39
+ export interface SeparatorPartProps {
40
+ /** Extra classes on the separator. */
41
+ class: string | undefined;
42
+ }
43
+ /** What `MenuCheckboxItem` hands the checkbox item part. */
44
+ export interface CheckboxItemPartProps {
45
+ /** Whether the item is checked. */
46
+ checked: boolean;
47
+ /** Called with the next state when the reader toggles it. */
48
+ onCheckedChange: (checked: boolean) => void;
49
+ /** Shown but not activatable. */
50
+ disabled: boolean;
51
+ /** Extra classes on the `<li>`. */
52
+ class: string | undefined;
53
+ /** The item's label. */
54
+ label: Snippet<[]>;
55
+ }
56
+ /** What `MenuRadioGroup` hands the radio group part. */
57
+ export interface RadioGroupPartProps {
58
+ /** The chosen value. */
59
+ value: string;
60
+ /** Called with the chosen value. */
61
+ onValueChange: (value: string) => void;
62
+ /** Visible heading; also the group's accessible name. */
63
+ label: string | undefined;
64
+ /** Extra classes on the `<li>`. */
65
+ class: string | undefined;
66
+ /** The `MenuRadioItem`s. */
67
+ children: Snippet<[]>;
68
+ }
69
+ /** What `MenuRadioItem` hands the radio item part. */
70
+ export interface RadioItemPartProps {
71
+ /** The value this item chooses. */
72
+ value: string;
73
+ /** Shown but not activatable. */
74
+ disabled: boolean;
75
+ /** Extra classes on the `<li>`. */
76
+ class: string | undefined;
77
+ /** The item's label. */
78
+ label: Snippet<[]>;
79
+ }
80
+ /** What `MenuSub` hands the submenu part. */
81
+ export interface SubPartProps {
82
+ /** Text of the item that opens the submenu. */
83
+ label: string;
84
+ /** Shown but not activatable. */
85
+ disabled: boolean;
86
+ /** Extra classes on the `<li>`. */
87
+ class: string | undefined;
88
+ /** The submenu's items. */
89
+ children: Snippet<[]>;
90
+ }
91
+ /** The components a bits-ui menu lends its descendants, and which kind of menu it is. */
92
+ export interface MenuParts {
93
+ readonly kind: 'dropdown' | 'context';
94
+ readonly item: Component<ItemPartProps>;
95
+ readonly separator: Component<SeparatorPartProps>;
96
+ readonly checkboxItem: Component<CheckboxItemPartProps>;
97
+ readonly radioGroup: Component<RadioGroupPartProps>;
98
+ readonly radioItem: Component<RadioItemPartProps>;
99
+ readonly sub: Component<SubPartProps>;
100
+ }
101
+ /** Lend the menu parts to every descendant. Called by `DropdownMenu` and `ContextMenu`. */
102
+ export declare function setMenuParts(parts: MenuParts): void;
103
+ /** The enclosing bits-ui menu's parts, or `undefined` outside one. */
104
+ export declare function getMenuParts(): MenuParts | undefined;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The bits-ui pieces a `DropdownMenu` or `ContextMenu` lends to the
3
+ * `MenuItem`, `MenuSeparator`, `MenuCheckboxItem`, `MenuRadioGroup`,
4
+ * `MenuRadioItem` and `MenuSub` inside it.
5
+ *
6
+ * Those children are written once for every kind of menu, but only the
7
+ * bits-ui menus need bits-ui's `Item` / `Separator` / `CheckboxItem` / … — and
8
+ * a static import of them would put the menu runtime (about 30 KB gzip) on
9
+ * every page that renders a plain navigation list (#129). So the parts travel
10
+ * down as context, set by `DropdownMenu` and `ContextMenu`, the only modules
11
+ * that import them. A child outside such a menu never sees them and never
12
+ * loads them.
13
+ *
14
+ * bits-ui's dropdown and context menus share these components (both re-export
15
+ * `bits/menu`'s `Item`, `Separator`, `CheckboxItem`, `RadioGroup`,
16
+ * `RadioItem` and `Sub*`), so one set of parts serves both (#157).
17
+ *
18
+ * Internal: not re-exported from the `ui` barrel.
19
+ *
20
+ * @module
21
+ */
22
+ import { getContext, setContext } from 'svelte';
23
+ const MENU_PARTS_KEY = Symbol('@thomasfosterau/components:menu-parts');
24
+ /** Lend the menu parts to every descendant. Called by `DropdownMenu` and `ContextMenu`. */
25
+ export function setMenuParts(parts) {
26
+ setContext(MENU_PARTS_KEY, parts);
27
+ }
28
+ /** The enclosing bits-ui menu's parts, or `undefined` outside one. */
29
+ export function getMenuParts() {
30
+ return getContext(MENU_PARTS_KEY);
31
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The one set of bits-ui menu parts, for `DropdownMenu` and `ContextMenu` to
3
+ * lend their children. Importing this module is what reaches bits-ui's menu
4
+ * runtime, so only those two components import it.
5
+ *
6
+ * Internal: not re-exported from the `ui` barrel.
7
+ *
8
+ * @module
9
+ */
10
+ import type { MenuParts } from './menu-parts.ts';
11
+ /** The parts for a menu of the given kind. */
12
+ export declare function menuParts(kind: MenuParts['kind']): MenuParts;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The one set of bits-ui menu parts, for `DropdownMenu` and `ContextMenu` to
3
+ * lend their children. Importing this module is what reaches bits-ui's menu
4
+ * runtime, so only those two components import it.
5
+ *
6
+ * Internal: not re-exported from the `ui` barrel.
7
+ *
8
+ * @module
9
+ */
10
+ import CheckboxItemPart from './CheckboxItemPart.svelte';
11
+ import ItemPart from './ItemPart.svelte';
12
+ import RadioGroupPart from './RadioGroupPart.svelte';
13
+ import RadioItemPart from './RadioItemPart.svelte';
14
+ import SeparatorPart from './SeparatorPart.svelte';
15
+ import SubPart from './SubPart.svelte';
16
+ /** The parts for a menu of the given kind. */
17
+ export function menuParts(kind) {
18
+ return {
19
+ kind,
20
+ item: ItemPart,
21
+ separator: SeparatorPart,
22
+ checkboxItem: CheckboxItemPart,
23
+ radioGroup: RadioGroupPart,
24
+ radioItem: RadioItemPart,
25
+ sub: SubPart,
26
+ };
27
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Text → anchor id.
3
+ *
4
+ * Shared by {@link Heading} and anything else that has to address a section it
5
+ * only knows the words of. Deliberately tiny and deterministic: the same text
6
+ * must slug identically on the server and in the browser, or an in-page link
7
+ * rendered during SSR points at an id hydration then changes.
8
+ *
9
+ * @module
10
+ */
11
+ /**
12
+ * Lower-case, strip anything that is not a word character, collapse runs of
13
+ * whitespace to single hyphens.
14
+ *
15
+ * ```ts
16
+ * slugify('Growing conditions & care') // 'growing-conditions-care'
17
+ * ```
18
+ */
19
+ export declare function slugify(text: string): string;