bitboss-ui 3.0.0-beta.68 → 3.0.0-beta.69

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 (915) hide show
  1. package/README.md +229 -90
  2. package/bin/bitboss-ui-mcp.mjs +284 -126
  3. package/bin/bitboss-ui.mjs +24 -2077
  4. package/bin/cli.mjs +1922 -0
  5. package/dist/ai/BbAccordion.md +1 -1
  6. package/dist/ai/BbAlert.md +1 -1
  7. package/dist/ai/BbAvatar.md +1 -1
  8. package/dist/ai/BbBadge.md +1 -1
  9. package/dist/ai/BbBadgeButton.md +1 -1
  10. package/dist/ai/BbBaseButton.md +1 -1
  11. package/dist/ai/BbBreadcrumbs.md +1 -1
  12. package/dist/ai/BbButton.md +1 -1
  13. package/dist/ai/BbCalendar.md +14 -1
  14. package/dist/ai/BbCarousel.md +1093 -0
  15. package/dist/ai/BbCheckbox.md +7 -5
  16. package/dist/ai/BbCheckboxGroup.md +15 -9
  17. package/dist/ai/BbColorInput.md +6 -4
  18. package/dist/ai/BbColorPalette.md +4 -1
  19. package/dist/ai/BbConfirm.md +1 -1
  20. package/dist/ai/BbDatePicker.md +8 -2
  21. package/dist/ai/BbDatePickerInput.md +14 -4
  22. package/dist/ai/BbDialog.md +1 -1
  23. package/dist/ai/BbDropdown.md +10 -13
  24. package/dist/ai/BbDropdownButton.md +3 -3
  25. package/dist/ai/BbDropzone.md +4 -15
  26. package/dist/ai/BbForm.md +8 -4
  27. package/dist/ai/BbHost.md +1 -1
  28. package/dist/ai/BbHoverCard.md +2 -2
  29. package/dist/ai/BbNumberInput.md +4 -4
  30. package/dist/ai/BbOffCanvas.md +12 -8
  31. package/dist/ai/BbPagination.md +6 -5
  32. package/dist/ai/BbPopover.md +11 -4
  33. package/dist/ai/BbRadio.md +9 -7
  34. package/dist/ai/BbRadioGroup.md +11 -7
  35. package/dist/ai/BbRating.md +10 -8
  36. package/dist/ai/BbSelect.md +11 -11
  37. package/dist/ai/BbSelectPopover.md +6 -6
  38. package/dist/ai/BbSlider.md +9 -6
  39. package/dist/ai/BbSpinner.md +1 -1
  40. package/dist/ai/BbSwitch.md +8 -7
  41. package/dist/ai/BbSwitchGroup.md +7 -7
  42. package/dist/ai/BbTable.md +19 -21
  43. package/dist/ai/BbTabs.md +23 -26
  44. package/dist/ai/BbTabsList.md +4 -4
  45. package/dist/ai/BbTabsRoot.md +1 -1
  46. package/dist/ai/BbTag.md +4 -4
  47. package/dist/ai/BbTextInput.md +8 -6
  48. package/dist/ai/BbTextarea.md +6 -5
  49. package/dist/ai/BbTimePicker.md +2 -2
  50. package/dist/ai/BbTimePickerInput.md +4 -4
  51. package/dist/ai/BbToast.md +8 -3
  52. package/dist/ai/BbTooltip.md +5 -4
  53. package/dist/ai/BbTree.md +1 -1
  54. package/dist/ai/ChipsBox.md +1 -1
  55. package/dist/ai/ClearableButton.md +1 -1
  56. package/dist/ai/CommonField.md +5 -5
  57. package/dist/ai/CommonFieldInput.md +1 -1
  58. package/dist/ai/CommonPopover.md +4 -4
  59. package/dist/ai/CommonTimeSelector.md +1 -1
  60. package/dist/ai/ErrorIcon.md +1 -1
  61. package/dist/ai/FlatListBox.md +1 -1
  62. package/dist/ai/GroupedListBox.md +1 -1
  63. package/dist/ai/ListBox.md +1 -1
  64. package/dist/ai/OptionsContainer.md +3 -3
  65. package/dist/ai/WarningIcon.md +1 -1
  66. package/dist/ai/changelog.json +526 -10
  67. package/dist/ai/components.json +95 -232
  68. package/dist/ai/composables/useToast.md +15 -15
  69. package/dist/ai/guides/agent-contract.md +7 -2
  70. package/dist/ai/guides/ai-router.md +14 -9
  71. package/dist/ai/guides/calendars-and-digits.md +123 -0
  72. package/dist/ai/guides/component-picker.md +1 -1
  73. package/dist/ai/guides/design-language.md +1 -1
  74. package/dist/ai/guides/design-tokens.md +4 -1
  75. package/dist/ai/guides/eslint-rules.md +18 -1
  76. package/dist/ai/guides/inertia-helpers.md +322 -41
  77. package/dist/ai/guides/installation-and-plugin-setup.md +166 -31
  78. package/dist/ai/guides/migration/components/bb-rating.md +1 -1
  79. package/dist/ai/guides/migration/components/bb-table.md +1 -0
  80. package/dist/ai/guides/migration/components/bb-tabs.md +32 -14
  81. package/dist/ai/guides/migration/components/bb-toast.md +4 -3
  82. package/dist/ai/guides/migration/v2-to-v3.md +158 -24
  83. package/dist/ai/guides/migration/v3-beta-css-classes.md +1 -0
  84. package/dist/ai/guides/migration/v3-beta-tooling.md +28 -11
  85. package/dist/ai/guides/options-items-playbook.md +5 -1
  86. package/dist/ai/guides/passthrough.md +12 -6
  87. package/dist/ai/guides/ssr-prefill.md +7 -1
  88. package/dist/ai/guides/validated-forms.md +9 -0
  89. package/dist/ai/helpers/inertia/manifest.json +23 -14
  90. package/dist/ai/helpers/inertia/useQuery.ts +74 -0
  91. package/dist/ai/helpers/inertia/useQueryObject.ts +33 -1
  92. package/dist/ai/helpers/inertia/useRouteQuery.ts +158 -30
  93. package/dist/ai/index.md +2 -0
  94. package/dist/ai/manifest/common.json +7 -7
  95. package/dist/ai/manifest/components/BbAccordion.tree.json +22 -4
  96. package/dist/ai/manifest/components/BbAlert.tree.json +26 -3
  97. package/dist/ai/manifest/components/BbAsterisk.tree.json +7 -1
  98. package/dist/ai/manifest/components/BbAvatar.tree.json +16 -2
  99. package/dist/ai/manifest/components/BbBadge.json +1 -1
  100. package/dist/ai/manifest/components/BbBadge.tree.json +39 -4
  101. package/dist/ai/manifest/components/BbBadgeButton.tree.json +2 -2
  102. package/dist/ai/manifest/components/BbBaseButton.tree.json +16 -1
  103. package/dist/ai/manifest/components/BbBaseCheckboxIcon.tree.json +18 -1
  104. package/dist/ai/manifest/components/BbBaseRadioIcon.tree.json +14 -1
  105. package/dist/ai/manifest/components/BbBaseSwitchIcon.tree.json +17 -1
  106. package/dist/ai/manifest/components/BbBreadcrumbs.json +1 -1
  107. package/dist/ai/manifest/components/BbBreadcrumbs.tree.json +34 -4
  108. package/dist/ai/manifest/components/BbButton.json +1 -1
  109. package/dist/ai/manifest/components/BbButton.tree.json +75 -4
  110. package/dist/ai/manifest/components/BbCalendar.json +2 -2
  111. package/dist/ai/manifest/components/BbCalendar.tree.json +81 -6
  112. package/dist/ai/manifest/components/BbCarousel.json +59 -0
  113. package/dist/ai/manifest/components/BbCarousel.tree.json +135 -0
  114. package/dist/ai/manifest/components/BbCheckbox.json +1 -1
  115. package/dist/ai/manifest/components/BbCheckbox.tree.json +31 -2
  116. package/dist/ai/manifest/components/BbCheckboxGroup.json +3 -3
  117. package/dist/ai/manifest/components/BbCheckboxGroup.tree.json +65 -2
  118. package/dist/ai/manifest/components/BbCollapsible.tree.json +11 -1
  119. package/dist/ai/manifest/components/BbColorInput.json +2 -2
  120. package/dist/ai/manifest/components/BbColorInput.tree.json +47 -3
  121. package/dist/ai/manifest/components/BbColorPalette.json +2 -2
  122. package/dist/ai/manifest/components/BbColorPalette.tree.json +36 -3
  123. package/dist/ai/manifest/components/BbConfigScope.json +1 -1
  124. package/dist/ai/manifest/components/BbConfirm.json +1 -1
  125. package/dist/ai/manifest/components/BbConfirm.tree.json +27 -3
  126. package/dist/ai/manifest/components/BbDatePicker.json +5 -5
  127. package/dist/ai/manifest/components/BbDatePicker.tree.json +42 -3
  128. package/dist/ai/manifest/components/BbDatePickerInput.json +2 -2
  129. package/dist/ai/manifest/components/BbDatePickerInput.tree.json +83 -4
  130. package/dist/ai/manifest/components/BbDialog.tree.json +28 -3
  131. package/dist/ai/manifest/components/BbDropdown.json +8 -7
  132. package/dist/ai/manifest/components/BbDropdown.tree.json +80 -3
  133. package/dist/ai/manifest/components/BbDropdownButton.json +4 -4
  134. package/dist/ai/manifest/components/BbDropdownButton.tree.json +46 -3
  135. package/dist/ai/manifest/components/BbDropzone.json +1 -1
  136. package/dist/ai/manifest/components/BbDropzone.tree.json +27 -1
  137. package/dist/ai/manifest/components/BbForm.json +1 -1
  138. package/dist/ai/manifest/components/BbHost.tree.json +1 -1
  139. package/dist/ai/manifest/components/BbHoverCard.json +3 -3
  140. package/dist/ai/manifest/components/BbHoverCard.tree.json +18 -1
  141. package/dist/ai/manifest/components/BbIcon.tree.json +7 -1
  142. package/dist/ai/manifest/components/BbIndicator.tree.json +27 -1
  143. package/dist/ai/manifest/components/BbNumberInput.json +2 -2
  144. package/dist/ai/manifest/components/BbNumberInput.tree.json +38 -2
  145. package/dist/ai/manifest/components/BbOffCanvas.json +1 -1
  146. package/dist/ai/manifest/components/BbOffCanvas.tree.json +55 -2
  147. package/dist/ai/manifest/components/BbPagination.json +1 -1
  148. package/dist/ai/manifest/components/BbPagination.tree.json +22 -3
  149. package/dist/ai/manifest/components/BbPopover.json +3 -3
  150. package/dist/ai/manifest/components/BbPopover.tree.json +20 -2
  151. package/dist/ai/manifest/components/BbProgress.tree.json +9 -1
  152. package/dist/ai/manifest/components/BbRadio.tree.json +30 -2
  153. package/dist/ai/manifest/components/BbRadioGroup.json +3 -3
  154. package/dist/ai/manifest/components/BbRadioGroup.tree.json +64 -2
  155. package/dist/ai/manifest/components/BbRating.json +4 -4
  156. package/dist/ai/manifest/components/BbRating.removed.json +1 -0
  157. package/dist/ai/manifest/components/BbRating.tree.json +37 -2
  158. package/dist/ai/manifest/components/BbSelect.json +3 -3
  159. package/dist/ai/manifest/components/BbSelect.tree.json +65 -4
  160. package/dist/ai/manifest/components/BbSelectPopover.json +8 -6
  161. package/dist/ai/manifest/components/BbSelectPopover.tree.json +91 -8
  162. package/dist/ai/manifest/components/BbSlider.json +13 -12
  163. package/dist/ai/manifest/components/BbSlider.tree.json +44 -1
  164. package/dist/ai/manifest/components/BbSmoothHeight.tree.json +10 -1
  165. package/dist/ai/manifest/components/BbSpinner.tree.json +21 -2
  166. package/dist/ai/manifest/components/BbSwitch.json +2 -2
  167. package/dist/ai/manifest/components/BbSwitch.tree.json +31 -2
  168. package/dist/ai/manifest/components/BbSwitchGroup.json +4 -4
  169. package/dist/ai/manifest/components/BbSwitchGroup.tree.json +60 -2
  170. package/dist/ai/manifest/components/BbTable.json +8 -8
  171. package/dist/ai/manifest/components/BbTable.tree.json +142 -4
  172. package/dist/ai/manifest/components/BbTabs.json +4 -4
  173. package/dist/ai/manifest/components/BbTabs.removed.json +5 -1
  174. package/dist/ai/manifest/components/BbTabs.tree.json +34 -3
  175. package/dist/ai/manifest/components/BbTabsList.json +4 -4
  176. package/dist/ai/manifest/components/BbTabsList.removed.json +5 -1
  177. package/dist/ai/manifest/components/BbTabsList.tree.json +24 -2
  178. package/dist/ai/manifest/components/BbTabsPanels.tree.json +16 -1
  179. package/dist/ai/manifest/components/BbTabsRoot.json +1 -1
  180. package/dist/ai/manifest/components/BbTag.json +2 -2
  181. package/dist/ai/manifest/components/BbTag.tree.json +47 -3
  182. package/dist/ai/manifest/components/BbTextInput.json +2 -2
  183. package/dist/ai/manifest/components/BbTextInput.tree.json +41 -2
  184. package/dist/ai/manifest/components/BbTextarea.json +2 -2
  185. package/dist/ai/manifest/components/BbTextarea.tree.json +44 -2
  186. package/dist/ai/manifest/components/BbTimePicker.json +5 -5
  187. package/dist/ai/manifest/components/BbTimePicker.tree.json +30 -3
  188. package/dist/ai/manifest/components/BbTimePickerInput.json +2 -2
  189. package/dist/ai/manifest/components/BbTimePickerInput.tree.json +55 -5
  190. package/dist/ai/manifest/components/BbToast.json +1 -1
  191. package/dist/ai/manifest/components/BbToast.tree.json +41 -2
  192. package/dist/ai/manifest/components/BbTooltip.json +3 -3
  193. package/dist/ai/manifest/components/BbTooltip.tree.json +17 -1
  194. package/dist/ai/manifest/components/BbTree.tree.json +14 -1
  195. package/dist/ai/manifest/components/ChipsBox.tree.json +1 -1
  196. package/dist/ai/manifest/components/ClearableButton.tree.json +8 -2
  197. package/dist/ai/manifest/components/CommonField.json +2 -2
  198. package/dist/ai/manifest/components/CommonField.tree.json +68 -1
  199. package/dist/ai/manifest/components/CommonFieldInput.tree.json +36 -6
  200. package/dist/ai/manifest/components/CommonPopover.json +7 -5
  201. package/dist/ai/manifest/components/CommonPopover.tree.json +11 -1
  202. package/dist/ai/manifest/components/CommonTimeSelector.tree.json +18 -2
  203. package/dist/ai/manifest/components/ErrorIcon.tree.json +8 -2
  204. package/dist/ai/manifest/components/FlatListBox.tree.json +2 -2
  205. package/dist/ai/manifest/components/GroupedListBox.tree.json +2 -2
  206. package/dist/ai/manifest/components/ListBox.tree.json +2 -2
  207. package/dist/ai/manifest/components/OptionsContainer.json +2 -2
  208. package/dist/ai/manifest/components/WarningIcon.tree.json +8 -2
  209. package/dist/ai/manifest/index.json +5 -4
  210. package/dist/ai/manifest/meta.json +8 -147
  211. package/dist/ai/manifest/types.advanced.json +78 -76
  212. package/dist/ai/manifest/types.api.json +17 -16
  213. package/dist/ai/manifest/types.wrapper.json +115 -112
  214. package/dist/ai/recipes/inertia/approvals-inbox.md +8 -8
  215. package/dist/ai/recipes/inertia/inline-edit-workspace.md +11 -11
  216. package/dist/ai/recipes/inertia/onboarding.md +8 -8
  217. package/dist/ai/recipes/inertia/ownership-atlas.md +6 -6
  218. package/dist/ai/recipes/inertia/record-form.md +14 -14
  219. package/dist/ai/recipes/inertia/records-workspace.md +11 -10
  220. package/dist/ai/recipes/inertia/settings-workspace.md +11 -11
  221. package/dist/ai/recipes/inertia/upload-center.md +10 -10
  222. package/dist/ai/recipes/inertia/wizard-form.md +14 -14
  223. package/dist/ai/recipes/nuxt/approvals-inbox.md +11 -11
  224. package/dist/ai/recipes/nuxt/inline-edit-workspace.md +13 -13
  225. package/dist/ai/recipes/nuxt/onboarding.md +8 -8
  226. package/dist/ai/recipes/nuxt/ownership-atlas.md +10 -10
  227. package/dist/ai/recipes/nuxt/record-form.md +14 -14
  228. package/dist/ai/recipes/nuxt/records-workspace.md +14 -13
  229. package/dist/ai/recipes/nuxt/settings-workspace.md +10 -10
  230. package/dist/ai/recipes/nuxt/upload-center.md +11 -11
  231. package/dist/ai/recipes/nuxt/wizard-form.md +15 -15
  232. package/dist/ai/recipes/vue/approvals-inbox.md +13 -11
  233. package/dist/ai/recipes/vue/inline-edit-workspace.md +13 -13
  234. package/dist/ai/recipes/vue/onboarding.md +14 -9
  235. package/dist/ai/recipes/vue/ownership-atlas.md +10 -10
  236. package/dist/ai/recipes/vue/record-form.md +16 -14
  237. package/dist/ai/recipes/vue/records-workspace.md +16 -13
  238. package/dist/ai/recipes/vue/settings-workspace.md +13 -11
  239. package/dist/ai/recipes/vue/upload-center.md +11 -11
  240. package/dist/ai/recipes/vue/wizard-form.md +16 -14
  241. package/dist/ai/source/BbAccordion.md +11 -14
  242. package/dist/ai/source/BbAlert.md +95 -89
  243. package/dist/ai/source/BbAsterisk.md +6 -7
  244. package/dist/ai/source/BbAvatar.md +37 -37
  245. package/dist/ai/source/BbBadge.md +85 -81
  246. package/dist/ai/source/BbBadgeButton.md +80 -76
  247. package/dist/ai/source/BbBaseButton.md +284 -276
  248. package/dist/ai/source/BbBaseCheckboxIcon.md +69 -63
  249. package/dist/ai/source/BbBaseRadioIcon.md +63 -57
  250. package/dist/ai/source/BbBaseSwitchIcon.md +84 -65
  251. package/dist/ai/source/BbBreadcrumbs.md +76 -63
  252. package/dist/ai/source/BbButton.md +63 -55
  253. package/dist/ai/source/BbCalendar.md +161 -146
  254. package/dist/ai/source/BbCarousel.md +2897 -0
  255. package/dist/ai/source/BbCheckbox.md +211 -186
  256. package/dist/ai/source/BbCheckboxGroup.md +108 -54
  257. package/dist/ai/source/BbCollapsible.md +7 -10
  258. package/dist/ai/source/BbColorInput.md +233 -227
  259. package/dist/ai/source/BbColorPalette.md +218 -140
  260. package/dist/ai/source/BbConfirm.md +33 -29
  261. package/dist/ai/source/BbConfirmPortal.md +30 -26
  262. package/dist/ai/source/BbDatePicker.md +202 -181
  263. package/dist/ai/source/BbDatePickerInput.md +751 -407
  264. package/dist/ai/source/BbDialog.md +187 -181
  265. package/dist/ai/source/BbDropdown.md +274 -218
  266. package/dist/ai/source/BbDropdownButton.md +50 -45
  267. package/dist/ai/source/BbDropdownGroup.md +242 -210
  268. package/dist/ai/source/BbDropzone.md +101 -100
  269. package/dist/ai/source/BbForm.md +28 -28
  270. package/dist/ai/source/BbHost.md +2 -2
  271. package/dist/ai/source/BbHoverCard.md +28 -18
  272. package/dist/ai/source/BbHoverCardPortal.md +9 -12
  273. package/dist/ai/source/BbIcon.md +27 -26
  274. package/dist/ai/source/BbIndicator.md +76 -70
  275. package/dist/ai/source/BbNumberInput.md +300 -293
  276. package/dist/ai/source/BbOffCanvas.md +236 -214
  277. package/dist/ai/source/BbPagination.md +134 -98
  278. package/dist/ai/source/BbPopover.md +32 -22
  279. package/dist/ai/source/BbPopoverPortal.md +9 -12
  280. package/dist/ai/source/BbProgress.md +20 -12
  281. package/dist/ai/source/BbRadio.md +188 -175
  282. package/dist/ai/source/BbRadioGroup.md +407 -350
  283. package/dist/ai/source/BbRating.md +192 -167
  284. package/dist/ai/source/BbSelect.md +474 -461
  285. package/dist/ai/source/BbSelectPopover.md +426 -385
  286. package/dist/ai/source/BbSlider.md +333 -266
  287. package/dist/ai/source/BbSmoothHeight.md +8 -9
  288. package/dist/ai/source/BbSpinner.md +20 -20
  289. package/dist/ai/source/BbSwitch.md +25 -13
  290. package/dist/ai/source/BbSwitchGroup.md +88 -26
  291. package/dist/ai/source/BbTable.md +560 -501
  292. package/dist/ai/source/BbTabs.md +129 -114
  293. package/dist/ai/source/BbTabsList.md +163 -135
  294. package/dist/ai/source/BbTabsPanels.md +127 -112
  295. package/dist/ai/source/BbTabsRoot.md +124 -109
  296. package/dist/ai/source/BbTag.md +264 -266
  297. package/dist/ai/source/BbTextInput.md +31 -25
  298. package/dist/ai/source/BbTextarea.md +33 -27
  299. package/dist/ai/source/BbTimePicker.md +128 -121
  300. package/dist/ai/source/BbTimePickerInput.md +356 -302
  301. package/dist/ai/source/BbToast.md +80 -36
  302. package/dist/ai/source/BbToastPortal.md +42 -30
  303. package/dist/ai/source/BbTooltip.md +154 -128
  304. package/dist/ai/source/BbTree.md +16 -12
  305. package/dist/ai/source/CommonField.md +94 -59
  306. package/dist/ai/source/CommonFieldInput.md +9 -9
  307. package/dist/ai/source/CommonPopover.md +28 -9
  308. package/dist/ai/source/CommonTimeSelector.md +41 -8
  309. package/dist/ai/source/FlatListBox.md +5 -4
  310. package/dist/ai/source/GroupedListBox.md +6 -5
  311. package/dist/ai/source/ListBox.md +1 -0
  312. package/dist/ai/source/OptionsContainer.md +39 -8
  313. package/dist/assets/svgs/chevron_left.svg_raw.js +3 -0
  314. package/dist/assets/svgs/pause.svg_raw.js +3 -0
  315. package/dist/assets/svgs/play.svg_raw.js +3 -0
  316. package/dist/assets/svgs/star.svg_raw.js +1 -1
  317. package/dist/calendar-runtime.js +112 -0
  318. package/dist/calendars.js +83 -0
  319. package/dist/components/BbAccordion/BbAccordion.vue.d.ts +2 -2
  320. package/dist/components/BbAccordion/BbAccordion.vue_vue_type_script_setup_true_lang.js +4 -4
  321. package/dist/components/BbAccordion/ptKeys.generated.d.ts +44 -0
  322. package/dist/components/BbAccordion/types.d.ts +5 -6
  323. package/dist/components/BbAlert/BbAlert.vue.d.ts +4 -4
  324. package/dist/components/BbAlert/BbAlert.vue_vue_type_script_setup_true_lang.js +4 -4
  325. package/dist/components/BbAlert/ptKeys.generated.d.ts +104 -0
  326. package/dist/components/BbAlert/types.d.ts +15 -8
  327. package/dist/components/BbAsterisk/BbAsterisk.vue.d.ts +2 -2
  328. package/dist/components/BbAsterisk/ptKeys.generated.d.ts +8 -0
  329. package/dist/components/BbAsterisk/types.d.ts +4 -5
  330. package/dist/components/BbAvatar/BbAvatar.vue.d.ts +3 -3
  331. package/dist/components/BbAvatar/ptKeys.generated.d.ts +12 -0
  332. package/dist/components/BbAvatar/types.d.ts +5 -6
  333. package/dist/components/BbBadge/BbBadge.vue.d.ts +4 -4
  334. package/dist/components/BbBadge/BbBadge.vue_vue_type_script_setup_true_lang.js +15 -15
  335. package/dist/components/BbBadge/BbBadgeButton.vue.d.ts +2 -2
  336. package/dist/components/BbBadge/badgeButtonContext.d.ts +5 -5
  337. package/dist/components/BbBadge/ptKeys.generated.d.ts +160 -0
  338. package/dist/components/BbBadge/types.d.ts +16 -9
  339. package/dist/components/BbBaseButton/BbBaseButton.vue.d.ts +2 -2
  340. package/dist/components/BbBaseButton/ptKeys.generated.d.ts +20 -0
  341. package/dist/components/BbBaseButton/types.d.ts +13 -6
  342. package/dist/components/BbBaseButton/useLinkState.d.ts +1 -1
  343. package/dist/components/BbBaseCheckboxIcon/BbBaseCheckboxIcon.vue.d.ts +2 -2
  344. package/dist/components/BbBaseCheckboxIcon/BbBaseCheckboxIcon.vue_vue_type_script_setup_true_lang.js +4 -4
  345. package/dist/components/BbBaseCheckboxIcon/ptKeys.generated.d.ts +40 -0
  346. package/dist/components/BbBaseCheckboxIcon/types.d.ts +12 -6
  347. package/dist/components/BbBaseRadioIcon/BbBaseRadioIcon.vue.d.ts +2 -2
  348. package/dist/components/BbBaseRadioIcon/BbBaseRadioIcon.vue_vue_type_script_setup_true_lang.js +4 -4
  349. package/dist/components/BbBaseRadioIcon/ptKeys.generated.d.ts +36 -0
  350. package/dist/components/BbBaseRadioIcon/types.d.ts +12 -6
  351. package/dist/components/BbBaseSwitchIcon/BbBaseSwitchIcon.vue.d.ts +2 -2
  352. package/dist/components/BbBaseSwitchIcon/BbBaseSwitchIcon.vue_vue_type_script_setup_true_lang.js +4 -4
  353. package/dist/components/BbBaseSwitchIcon/ptKeys.generated.d.ts +40 -0
  354. package/dist/components/BbBaseSwitchIcon/types.d.ts +12 -6
  355. package/dist/components/BbBreadcrumbs/BbBreadcrumbs.vue.d.ts +2 -2
  356. package/dist/components/BbBreadcrumbs/BbBreadcrumbs.vue_vue_type_script_setup_true_lang.js +5 -5
  357. package/dist/components/BbBreadcrumbs/ptKeys.generated.d.ts +48 -0
  358. package/dist/components/BbBreadcrumbs/types.d.ts +15 -8
  359. package/dist/components/BbButton/BbButton.vue.d.ts +4 -4
  360. package/dist/components/BbButton/BbButton.vue_vue_type_script_setup_true_lang.js +20 -20
  361. package/dist/components/BbButton/ptKeys.generated.d.ts +196 -0
  362. package/dist/components/BbButton/toggleRoving.js +29 -28
  363. package/dist/components/BbButton/types.d.ts +17 -11
  364. package/dist/components/BbCalendar/BbCalendar.vue.d.ts +9 -71
  365. package/dist/components/BbCalendar/BbCalendar.vue_vue_type_script_setup_true_lang.js +34 -32
  366. package/dist/components/BbCalendar/CalendarMonthPanel.vue_vue_type_script_setup_true_lang.js +67 -65
  367. package/dist/components/BbCalendar/CalendarYearPanel.vue_vue_type_script_setup_true_lang.js +76 -67
  368. package/dist/components/BbCalendar/calendarHost.d.ts +1 -1
  369. package/dist/components/BbCalendar/calendarMath.d.ts +102 -0
  370. package/dist/components/BbCalendar/calendarMath.js +124 -0
  371. package/dist/components/BbCalendar/ptKeys.generated.d.ts +248 -0
  372. package/dist/components/BbCalendar/types.d.ts +15 -9
  373. package/dist/components/BbCalendar/useCalendarContext.d.ts +43 -17
  374. package/dist/components/BbCalendar/useCalendarGrid.d.ts +71 -4
  375. package/dist/components/BbCalendar/useCalendarGrid.js +264 -210
  376. package/dist/components/BbCalendar/useDayGrid.d.ts +26 -8
  377. package/dist/components/BbCalendar/useDayGrid.js +178 -172
  378. package/dist/components/BbCalendar/useDayjsLocale.d.ts +18 -3
  379. package/dist/components/BbCalendar/useDayjsLocale.js +28 -28
  380. package/dist/components/BbCalendar/useToday.d.ts +5 -3
  381. package/dist/components/BbCalendar/useToday.js +22 -12
  382. package/dist/components/BbCarousel/BbCarousel.vue.d.ts +51 -0
  383. package/dist/components/BbCarousel/BbCarousel.vue.js +5 -0
  384. package/dist/components/BbCarousel/BbCarousel.vue_vue_type_script_setup_true_lang.js +818 -0
  385. package/dist/components/BbCarousel/ptKeys.generated.d.ts +60 -0
  386. package/dist/components/BbCarousel/types.d.ts +213 -0
  387. package/dist/components/BbCarousel/types.js +27 -0
  388. package/dist/components/BbCheckbox/BbCheckbox.vue.d.ts +4 -4
  389. package/dist/components/BbCheckbox/BbCheckbox.vue_vue_type_script_setup_true_lang.js +30 -30
  390. package/dist/components/BbCheckbox/ptKeys.generated.d.ts +220 -0
  391. package/dist/components/BbCheckbox/types.d.ts +30 -14
  392. package/dist/components/BbCheckboxGroup/BbCheckboxGroup.vue.d.ts +164 -326
  393. package/dist/components/BbCheckboxGroup/BbCheckboxGroup.vue_vue_type_script_setup_true_lang.js +50 -50
  394. package/dist/components/BbCheckboxGroup/ptKeys.generated.d.ts +492 -0
  395. package/dist/components/BbCheckboxGroup/types.d.ts +32 -23
  396. package/dist/components/BbCollapsible/BbCollapsible.vue.d.ts +3 -3
  397. package/dist/components/BbCollapsible/BbCollapsible.vue_vue_type_script_setup_true_lang.js +1 -1
  398. package/dist/components/BbCollapsible/ptKeys.generated.d.ts +20 -0
  399. package/dist/components/BbCollapsible/types.d.ts +5 -6
  400. package/dist/components/BbColorInput/BbColorInput.vue.d.ts +3 -3
  401. package/dist/components/BbColorInput/BbColorInput.vue_vue_type_script_setup_true_lang.js +124 -124
  402. package/dist/components/BbColorInput/ptKeys.generated.d.ts +656 -0
  403. package/dist/components/BbColorInput/types.d.ts +24 -14
  404. package/dist/components/BbColorPalette/BbColorPalette.vue.d.ts +2 -2
  405. package/dist/components/BbColorPalette/BbColorPalette.vue_vue_type_script_setup_true_lang.js +324 -287
  406. package/dist/components/BbColorPalette/ptKeys.generated.d.ts +40 -0
  407. package/dist/components/BbColorPalette/types.d.ts +15 -8
  408. package/dist/components/BbConfigScope/BbConfigScope.vue.d.ts +1 -1
  409. package/dist/components/BbConfigScope/types.d.ts +1 -1
  410. package/dist/components/BbConfirm/BbConfirm.vue.d.ts +1 -1
  411. package/dist/components/BbConfirm/BbConfirm.vue_vue_type_script_setup_true_lang.js +24 -24
  412. package/dist/components/BbConfirm/BbConfirmPortal.vue.d.ts +1 -1
  413. package/dist/components/BbConfirm/confirmEntry.d.ts +2 -2
  414. package/dist/components/BbConfirm/ptKeys.generated.d.ts +184 -0
  415. package/dist/components/BbConfirm/types.d.ts +14 -7
  416. package/dist/components/BbDatePicker/BbDatePicker.vue.d.ts +16 -97
  417. package/dist/components/BbDatePicker/BbDatePicker.vue_vue_type_script_setup_true_lang.js +208 -205
  418. package/dist/components/BbDatePicker/ptKeys.generated.d.ts +324 -0
  419. package/dist/components/BbDatePicker/types.d.ts +20 -13
  420. package/dist/components/BbDatePickerInput/BbDatePickerInput.vue.d.ts +17 -306
  421. package/dist/components/BbDatePickerInput/BbDatePickerInput.vue_vue_type_script_setup_true_lang.js +696 -579
  422. package/dist/components/BbDatePickerInput/calendarFields.d.ts +91 -0
  423. package/dist/components/BbDatePickerInput/calendarFields.js +188 -0
  424. package/dist/components/BbDatePickerInput/dateFieldLayout.d.ts +6 -0
  425. package/dist/components/BbDatePickerInput/dateFieldLayout.js +11 -1
  426. package/dist/components/BbDatePickerInput/ptKeys.generated.d.ts +1156 -0
  427. package/dist/components/BbDatePickerInput/types.d.ts +30 -20
  428. package/dist/components/BbDialog/BbDialog.vue.d.ts +6 -6
  429. package/dist/components/BbDialog/BbDialog.vue_vue_type_script_setup_true_lang.js +7 -7
  430. package/dist/components/BbDialog/ptKeys.generated.d.ts +100 -0
  431. package/dist/components/BbDialog/types.d.ts +24 -18
  432. package/dist/components/BbDropdown/AdaptiveDropdown.vue.d.ts +1 -1
  433. package/dist/components/BbDropdown/BbDropdown.vue.d.ts +3 -3
  434. package/dist/components/BbDropdown/BbDropdown.vue_vue_type_script_setup_true_lang.js +333 -327
  435. package/dist/components/BbDropdown/BbDropdownGroup.vue.d.ts +2 -2
  436. package/dist/components/BbDropdown/BbDropdownList.vue.d.ts +1 -1
  437. package/dist/components/BbDropdown/BbDropdownList.vue_vue_type_script_setup_true_lang.js +278 -277
  438. package/dist/components/BbDropdown/DropdownRow.vue.d.ts +2 -2
  439. package/dist/components/BbDropdown/normalizeGroups.d.ts +2 -2
  440. package/dist/components/BbDropdown/ptKeys.generated.d.ts +228 -0
  441. package/dist/components/BbDropdown/types.d.ts +40 -35
  442. package/dist/components/BbDropdown/useDropdownContext.d.ts +2 -2
  443. package/dist/components/BbDropdown/useDropdownGroupRegistry.d.ts +5 -5
  444. package/dist/components/BbDropdownButton/BbDropdownButton.vue.d.ts +4 -4
  445. package/dist/components/BbDropdownButton/BbDropdownButton.vue_vue_type_script_setup_true_lang.js +84 -84
  446. package/dist/components/BbDropdownButton/ptKeys.generated.d.ts +616 -0
  447. package/dist/components/BbDropdownButton/types.d.ts +17 -10
  448. package/dist/components/BbDropzone/BbDropzone.vue.d.ts +6 -25
  449. package/dist/components/BbDropzone/BbDropzone.vue_vue_type_script_setup_true_lang.js +14 -14
  450. package/dist/components/BbDropzone/ptKeys.generated.d.ts +76 -0
  451. package/dist/components/BbDropzone/types.d.ts +15 -8
  452. package/dist/components/BbForm/BbForm.vue.d.ts +3 -3
  453. package/dist/components/BbForm/BbFormCustomField.d.ts +1 -1
  454. package/dist/components/BbForm/bindFormField.d.ts +4 -4
  455. package/dist/components/BbForm/formFields.d.ts +5 -5
  456. package/dist/components/BbForm/formSchema.d.ts +4 -4
  457. package/dist/components/BbHost/BbHost.vue.d.ts +1 -1
  458. package/dist/components/BbHost/BbHostOpening.d.ts +3 -3
  459. package/dist/components/BbHost/types.d.ts +1 -1
  460. package/dist/components/BbHoverCard/BbHoverCard.vue.d.ts +3 -3
  461. package/dist/components/BbHoverCard/BbHoverCard.vue_vue_type_script_setup_true_lang.js +150 -144
  462. package/dist/components/BbHoverCard/BbHoverCardPortal.vue.d.ts +1 -1
  463. package/dist/components/BbHoverCard/ptKeys.generated.d.ts +44 -0
  464. package/dist/components/BbHoverCard/types.d.ts +8 -9
  465. package/dist/components/BbIcon/BbIcon.vue.d.ts +3 -3
  466. package/dist/components/BbIcon/ptKeys.generated.d.ts +8 -0
  467. package/dist/components/BbIcon/types.d.ts +7 -8
  468. package/dist/components/BbIndicator/BbIndicator.vue.d.ts +4 -4
  469. package/dist/components/BbIndicator/BbIndicator.vue_vue_type_script_setup_true_lang.js +1 -1
  470. package/dist/components/BbIndicator/ptKeys.generated.d.ts +52 -0
  471. package/dist/components/BbIndicator/types.d.ts +14 -7
  472. package/dist/components/BbNumberInput/BbNumberInput.vue.d.ts +3 -3
  473. package/dist/components/BbNumberInput/BbNumberInput.vue_vue_type_script_setup_true_lang.js +79 -79
  474. package/dist/components/BbNumberInput/numberDisplay.d.ts +10 -11
  475. package/dist/components/BbNumberInput/ptKeys.generated.d.ts +476 -0
  476. package/dist/components/BbNumberInput/types.d.ts +23 -13
  477. package/dist/components/BbOffCanvas/BbOffCanvas.vue.d.ts +7 -7
  478. package/dist/components/BbOffCanvas/BbOffCanvas.vue_vue_type_script_setup_true_lang.js +407 -406
  479. package/dist/components/BbOffCanvas/ptKeys.generated.d.ts +88 -0
  480. package/dist/components/BbOffCanvas/sheetAttrs.d.ts +1 -1
  481. package/dist/components/BbOffCanvas/sheetSnap.d.ts +2 -2
  482. package/dist/components/BbOffCanvas/types.d.ts +30 -23
  483. package/dist/components/BbOffCanvas/useOffCanvasStack.d.ts +1 -1
  484. package/dist/components/BbPagination/BbPagination.vue.d.ts +3 -3
  485. package/dist/components/BbPagination/BbPagination.vue_vue_type_script_setup_true_lang.js +6 -6
  486. package/dist/components/BbPagination/paginationFit.d.ts +1 -1
  487. package/dist/components/BbPagination/ptKeys.generated.d.ts +48 -0
  488. package/dist/components/BbPagination/types.d.ts +16 -8
  489. package/dist/components/BbPopover/BbPopover.vue.d.ts +3 -3
  490. package/dist/components/BbPopover/BbPopover.vue_vue_type_script_setup_true_lang.js +119 -113
  491. package/dist/components/BbPopover/BbPopoverPortal.vue.d.ts +1 -1
  492. package/dist/components/BbPopover/ptKeys.generated.d.ts +52 -0
  493. package/dist/components/BbPopover/types.d.ts +8 -9
  494. package/dist/components/BbProgress/BbProgress.vue.d.ts +2 -2
  495. package/dist/components/BbProgress/BbProgress.vue_vue_type_script_setup_true_lang.js +1 -1
  496. package/dist/components/BbProgress/ptKeys.generated.d.ts +20 -0
  497. package/dist/components/BbProgress/types.d.ts +4 -5
  498. package/dist/components/BbRadio/BbRadio.vue.d.ts +4 -4
  499. package/dist/components/BbRadio/BbRadio.vue_vue_type_script_setup_true_lang.js +30 -30
  500. package/dist/components/BbRadio/ptKeys.generated.d.ts +196 -0
  501. package/dist/components/BbRadio/types.d.ts +24 -13
  502. package/dist/components/BbRadioGroup/BbRadioGroup.vue.d.ts +148 -267
  503. package/dist/components/BbRadioGroup/BbRadioGroup.vue_vue_type_script_setup_true_lang.js +44 -44
  504. package/dist/components/BbRadioGroup/ptKeys.generated.d.ts +492 -0
  505. package/dist/components/BbRadioGroup/types.d.ts +30 -19
  506. package/dist/components/BbRating/BbRating.vue.d.ts +3 -3
  507. package/dist/components/BbRating/BbRating.vue_vue_type_script_setup_true_lang.js +107 -107
  508. package/dist/components/BbRating/ptKeys.generated.d.ts +152 -0
  509. package/dist/components/BbRating/types.d.ts +31 -20
  510. package/dist/components/BbRating/types.js +1 -1
  511. package/dist/components/BbSelect/BbSelect.vue.d.ts +264 -497
  512. package/dist/components/BbSelect/BbSelect.vue_vue_type_script_setup_true_lang.js +190 -190
  513. package/dist/components/BbSelect/ptKeys.generated.d.ts +960 -0
  514. package/dist/components/BbSelect/types.d.ts +29 -20
  515. package/dist/components/BbSelectPopover/BbSelectPopover.vue.d.ts +19 -51
  516. package/dist/components/BbSelectPopover/BbSelectPopover.vue_vue_type_script_setup_true_lang.js +518 -512
  517. package/dist/components/BbSelectPopover/knownItems.d.ts +4 -4
  518. package/dist/components/BbSelectPopover/ptKeys.generated.d.ts +148 -0
  519. package/dist/components/BbSelectPopover/reclickClears.d.ts +1 -1
  520. package/dist/components/BbSelectPopover/sheetChipAttrs.d.ts +1 -1
  521. package/dist/components/BbSelectPopover/types.d.ts +23 -15
  522. package/dist/components/BbSlider/BbSlider.vue.d.ts +14 -80
  523. package/dist/components/BbSlider/BbSlider.vue_vue_type_script_setup_true_lang.js +286 -270
  524. package/dist/components/BbSlider/ptKeys.generated.d.ts +316 -0
  525. package/dist/components/BbSlider/types.d.ts +28 -16
  526. package/dist/components/BbSlider/types.js +2 -0
  527. package/dist/components/BbSmoothHeight/BbSmoothHeight.vue.d.ts +3 -3
  528. package/dist/components/BbSmoothHeight/ptKeys.generated.d.ts +8 -0
  529. package/dist/components/BbSmoothHeight/types.d.ts +5 -6
  530. package/dist/components/BbSpinner/BbSpinner.vue.d.ts +3 -3
  531. package/dist/components/BbSpinner/ptKeys.generated.d.ts +8 -0
  532. package/dist/components/BbSpinner/types.d.ts +5 -6
  533. package/dist/components/BbSwitch/BbSwitch.vue.d.ts +4 -4
  534. package/dist/components/BbSwitch/BbSwitch.vue_vue_type_script_setup_true_lang.js +30 -30
  535. package/dist/components/BbSwitch/ptKeys.generated.d.ts +220 -0
  536. package/dist/components/BbSwitch/types.d.ts +15 -5
  537. package/dist/components/BbSwitchGroup/BbSwitchGroup.vue.d.ts +35 -114
  538. package/dist/components/BbSwitchGroup/BbSwitchGroup.vue_vue_type_script_setup_true_lang.js +10 -10
  539. package/dist/components/BbSwitchGroup/ptKeys.generated.d.ts +332 -0
  540. package/dist/components/BbSwitchGroup/types.d.ts +14 -5
  541. package/dist/components/BbTable/BbTable.vue.d.ts +10 -10
  542. package/dist/components/BbTable/BbTable.vue_vue_type_script_setup_true_lang.js +1274 -1273
  543. package/dist/components/BbTable/BbTableDataRow.d.ts +4 -4
  544. package/dist/components/BbTable/BbTableEdgeRow.d.ts +5 -5
  545. package/dist/components/BbTable/BbTableExpandRow.d.ts +2 -2
  546. package/dist/components/BbTable/BbTableSelectToggle.d.ts +2 -2
  547. package/dist/components/BbTable/estimatedFloors.golden.d.ts +1 -1
  548. package/dist/components/BbTable/gridWidgets.d.ts +1 -1
  549. package/dist/components/BbTable/measuredFloors.d.ts +1 -1
  550. package/dist/components/BbTable/measuredFloorsTestKit.d.ts +1 -1
  551. package/dist/components/BbTable/ptKeys.generated.d.ts +280 -0
  552. package/dist/components/BbTable/types.d.ts +30 -22
  553. package/dist/components/BbTable/utils.d.ts +5 -5
  554. package/dist/components/BbTable/utils.js +89 -88
  555. package/dist/components/BbTabs/BbTabs.vue.d.ts +41 -69
  556. package/dist/components/BbTabs/BbTabs.vue_vue_type_script_setup_true_lang.js +13 -13
  557. package/dist/components/BbTabs/BbTabsList.vue.d.ts +3 -3
  558. package/dist/components/BbTabs/BbTabsList.vue_vue_type_script_setup_true_lang.js +121 -122
  559. package/dist/components/BbTabs/BbTabsPanels.vue.d.ts +3 -3
  560. package/dist/components/BbTabs/BbTabsPanels.vue_vue_type_script_setup_true_lang.js +1 -1
  561. package/dist/components/BbTabs/BbTabsRoot.vue.d.ts +2 -2
  562. package/dist/components/BbTabs/ptKeys.generated.d.ts +226 -0
  563. package/dist/components/BbTabs/types.d.ts +40 -22
  564. package/dist/components/BbTag/BbTag.vue.d.ts +3 -3
  565. package/dist/components/BbTag/BbTag.vue_vue_type_script_setup_true_lang.js +261 -262
  566. package/dist/components/BbTag/ptKeys.generated.d.ts +540 -0
  567. package/dist/components/BbTag/types.d.ts +23 -13
  568. package/dist/components/BbTextInput/BbTextInput.vue.d.ts +14 -166
  569. package/dist/components/BbTextInput/BbTextInput.vue_vue_type_script_setup_true_lang.js +110 -110
  570. package/dist/components/BbTextInput/ptKeys.generated.d.ts +608 -0
  571. package/dist/components/BbTextInput/types.d.ts +23 -14
  572. package/dist/components/BbTextarea/BbTextarea.vue.d.ts +14 -166
  573. package/dist/components/BbTextarea/BbTextarea.vue_vue_type_script_setup_true_lang.js +110 -110
  574. package/dist/components/BbTextarea/ptKeys.generated.d.ts +608 -0
  575. package/dist/components/BbTextarea/types.d.ts +23 -14
  576. package/dist/components/BbTimePicker/BbTimePicker.vue.d.ts +13 -33
  577. package/dist/components/BbTimePicker/BbTimePicker.vue_vue_type_script_setup_true_lang.js +6 -6
  578. package/dist/components/BbTimePicker/ptKeys.generated.d.ts +80 -0
  579. package/dist/components/BbTimePicker/types.d.ts +17 -11
  580. package/dist/components/BbTimePickerInput/BbTimePickerInput.vue.d.ts +15 -198
  581. package/dist/components/BbTimePickerInput/BbTimePickerInput.vue_vue_type_script_setup_true_lang.js +398 -387
  582. package/dist/components/BbTimePickerInput/ptKeys.generated.d.ts +732 -0
  583. package/dist/components/BbTimePickerInput/types.d.ts +29 -17
  584. package/dist/components/BbToast/BbToast.vue.d.ts +2 -2
  585. package/dist/components/BbToast/BbToast.vue_vue_type_script_setup_true_lang.js +59 -52
  586. package/dist/components/BbToast/BbToastMessage.vue.d.ts +2 -2
  587. package/dist/components/BbToast/BbToastPortal.vue.d.ts +1 -1
  588. package/dist/components/BbToast/BbToastRegion.vue.d.ts +5 -3
  589. package/dist/components/BbToast/ptKeys.generated.d.ts +232 -0
  590. package/dist/components/BbToast/types.d.ts +20 -11
  591. package/dist/components/BbTooltip/BbTooltip.vue.d.ts +4 -4
  592. package/dist/components/BbTooltip/BbTooltip.vue_vue_type_script_setup_true_lang.js +99 -88
  593. package/dist/components/BbTooltip/ptKeys.generated.d.ts +36 -0
  594. package/dist/components/BbTooltip/tooltipWarmup.d.ts +2 -2
  595. package/dist/components/BbTooltip/types.d.ts +15 -8
  596. package/dist/components/BbTree/BbTree.vue.d.ts +7 -11
  597. package/dist/components/BbTree/BbTreeLevel.vue.d.ts +1 -1
  598. package/dist/components/BbTree/context.d.ts +2 -2
  599. package/dist/components/BbTree/ptKeys.generated.d.ts +16 -0
  600. package/dist/components/BbTree/types.d.ts +5 -6
  601. package/dist/components/ChipsBox/ChipsBox.vue.d.ts +2 -2
  602. package/dist/components/ChipsBox/types.d.ts +2 -2
  603. package/dist/components/ClearableButton/ClearableButton.vue.d.ts +2 -2
  604. package/dist/components/CloseIcon/CloseButton.vue.d.ts +2 -2
  605. package/dist/components/CommaBox/CommaBox.vue.d.ts +2 -2
  606. package/dist/components/CommaBox/types.d.ts +2 -2
  607. package/dist/components/CommonField/CommonField.vue.d.ts +7 -7
  608. package/dist/components/CommonField/CommonField.vue_vue_type_script_setup_true_lang.js +9 -4
  609. package/dist/components/CommonField/messageHeightMatrix.d.ts +1 -1
  610. package/dist/components/CommonField/types.d.ts +18 -14
  611. package/dist/components/CommonFieldInput/CommonFieldInput.vue.d.ts +3 -3
  612. package/dist/components/CommonFieldInput/types.d.ts +3 -3
  613. package/dist/components/CommonPopover/CommonPopover.vue.d.ts +4 -4
  614. package/dist/components/CommonPopover/CommonPopover.vue_vue_type_script_setup_true_lang.js +56 -55
  615. package/dist/components/CommonPopover/resolvePlacement.d.ts +9 -0
  616. package/dist/components/CommonPopover/resolvePlacement.js +9 -0
  617. package/dist/components/CommonPopover/types.d.ts +5 -5
  618. package/dist/components/CommonTimeSelector/CommonTimeSelector.vue.d.ts +2 -2
  619. package/dist/components/CommonTimeSelector/CommonTimeSelector.vue_vue_type_script_setup_true_lang.js +110 -99
  620. package/dist/components/CommonTimeSelector/useMeridiem.d.ts +1 -1
  621. package/dist/components/ErrorIcon/ErrorIcon.vue.d.ts +2 -2
  622. package/dist/components/FlatListBox/FlatListBox.vue.d.ts +2 -2
  623. package/dist/components/FlatListBox/types.d.ts +2 -2
  624. package/dist/components/GroupedListBox/GroupedListBox.vue.d.ts +2 -2
  625. package/dist/components/GroupedListBox/types.d.ts +2 -2
  626. package/dist/components/ListBox/ListBox.vue.d.ts +2 -2
  627. package/dist/components/ListBox/types.d.ts +2 -2
  628. package/dist/components/OptionsContainer/OptionsContainer.vue.d.ts +1 -1
  629. package/dist/components/OptionsContainer/OptionsContainer.vue_vue_type_script_setup_true_lang.js +55 -41
  630. package/dist/components/OptionsContainer/types.d.ts +3 -3
  631. package/dist/components/Transitions/Slide.vue.d.ts +5 -3
  632. package/dist/components/Transitions/Slide.vue.js +1 -1
  633. package/dist/components/WarningIcon/WarningIcon.vue.d.ts +2 -2
  634. package/dist/composables/autoHost.d.ts +1 -1
  635. package/dist/composables/formSubmitLock.d.ts +5 -5
  636. package/dist/composables/hostOpenings.d.ts +6 -6
  637. package/dist/composables/hostRegistry.d.ts +2 -2
  638. package/dist/composables/overlayRegistry.d.ts +25 -25
  639. package/dist/composables/overlayRegistry.js +13 -7
  640. package/dist/composables/useBaseOptions.d.ts +2 -2
  641. package/dist/composables/useBbConfig.d.ts +5 -5
  642. package/dist/composables/useBbDialog.d.ts +17 -17
  643. package/dist/composables/useBbDialog.js +2 -1
  644. package/dist/composables/useBbDropdown.d.ts +1 -1
  645. package/dist/composables/useBbForm.d.ts +2 -2
  646. package/dist/composables/useBbFormField.d.ts +4 -4
  647. package/dist/composables/useBbOffCanvas.d.ts +6 -6
  648. package/dist/composables/useBbTable.d.ts +4 -4
  649. package/dist/composables/useBbTabs.d.ts +4 -4
  650. package/dist/composables/useBbTabs.js +44 -43
  651. package/dist/composables/useBreakpoint.d.ts +1 -1
  652. package/dist/composables/useCharacterCounter.d.ts +2 -2
  653. package/dist/composables/useChoiceIndicator.d.ts +2 -2
  654. package/dist/composables/useClosingInert.d.ts +1 -1
  655. package/dist/composables/useConfig.d.ts +3 -3
  656. package/dist/composables/useConfigDefaults.d.ts +3 -3
  657. package/dist/composables/useConfirm.d.ts +11 -11
  658. package/dist/composables/useDirection.d.ts +43 -0
  659. package/dist/composables/useDirection.js +12 -0
  660. package/dist/composables/useFormBinding.d.ts +4 -4
  661. package/dist/composables/useId.d.ts +1 -1
  662. package/dist/composables/useItemsGetter.d.ts +3 -3
  663. package/dist/composables/useKeyboardInset.d.ts +1 -1
  664. package/dist/composables/useListboxFocus.d.ts +1 -1
  665. package/dist/composables/useLocale.d.ts +2 -2
  666. package/dist/composables/useOnDemandOpener.d.ts +3 -3
  667. package/dist/composables/useOverlayNavigation.d.ts +1 -1
  668. package/dist/composables/useOverlayYield.d.ts +1 -1
  669. package/dist/composables/usePassthrough.d.ts +6 -6
  670. package/dist/composables/useQuery.d.ts +1 -1
  671. package/dist/composables/useRefusedCloseAnnouncement.d.ts +1 -1
  672. package/dist/composables/useSafeArea.d.ts +1 -1
  673. package/dist/composables/useSafeAreaInternal.d.ts +1 -1
  674. package/dist/composables/useSegmentedFields.d.ts +25 -0
  675. package/dist/composables/useSegmentedFields.js +165 -115
  676. package/dist/composables/useServerPrefetch.d.ts +2 -2
  677. package/dist/composables/useSheetSurface.d.ts +1 -1
  678. package/dist/composables/useSsrState.d.ts +2 -2
  679. package/dist/composables/useToast.d.ts +8 -1
  680. package/dist/composables/useToast.js +39 -35
  681. package/dist/composables/useTypeahead.js +22 -21
  682. package/dist/deprecation/ai-deprecations.json.d.ts +116 -0
  683. package/dist/deprecation/ai-deprecations.json.js +1 -1
  684. package/dist/deprecation/removedProps.d.ts +1 -1
  685. package/dist/directives/bbColor.d.ts +1 -1
  686. package/dist/directives/bbDate.d.ts +1 -1
  687. package/dist/directives/bbDialog.d.ts +3 -3
  688. package/dist/directives/bbDropdown.d.ts +1 -1
  689. package/dist/directives/bbHoverCard.d.ts +3 -3
  690. package/dist/directives/bbOffCanvas.d.ts +2 -2
  691. package/dist/directives/bbPopover.d.ts +3 -3
  692. package/dist/directives/bbTime.d.ts +1 -1
  693. package/dist/directives/bbTooltip.d.ts +4 -4
  694. package/dist/directives/directivePortal.d.ts +4 -4
  695. package/dist/directives/overlayTrigger.d.ts +4 -4
  696. package/dist/directives/overlayTrigger.js +2 -1
  697. package/dist/i18n/eraNames.d.ts +2 -0
  698. package/dist/i18n/eraNames.js +2013 -0
  699. package/dist/i18n/index.d.ts +9 -7
  700. package/dist/i18n/localeTags.d.ts +36 -0
  701. package/dist/i18n/locales/ar.json +176 -0
  702. package/dist/i18n/locales/cs.json +21 -2
  703. package/dist/i18n/locales/da.json +21 -2
  704. package/dist/i18n/locales/de-CH.json +21 -2
  705. package/dist/i18n/locales/de.json +21 -2
  706. package/dist/i18n/locales/el.json +21 -2
  707. package/dist/i18n/locales/en-GB.json +21 -2
  708. package/dist/i18n/locales/en.json +21 -2
  709. package/dist/i18n/locales/es-MX.json +21 -2
  710. package/dist/i18n/locales/es.json +21 -2
  711. package/dist/i18n/locales/fa.json +176 -0
  712. package/dist/i18n/locales/fi.json +21 -2
  713. package/dist/i18n/locales/fr.json +21 -2
  714. package/dist/i18n/locales/he.json +176 -0
  715. package/dist/i18n/locales/hu.json +21 -2
  716. package/dist/i18n/locales/it.json +21 -2
  717. package/dist/i18n/locales/ja.json +21 -2
  718. package/dist/i18n/locales/ko.json +21 -2
  719. package/dist/i18n/locales/nb.json +21 -2
  720. package/dist/i18n/locales/nl.json +21 -2
  721. package/dist/i18n/locales/pl.json +21 -2
  722. package/dist/i18n/locales/pt-BR.json +21 -2
  723. package/dist/i18n/locales/pt-PT.json +21 -2
  724. package/dist/i18n/locales/ro.json +21 -2
  725. package/dist/i18n/locales/ru.json +21 -2
  726. package/dist/i18n/locales/sv.json +21 -2
  727. package/dist/i18n/locales/tr.json +21 -2
  728. package/dist/i18n/locales/uk.json +21 -2
  729. package/dist/i18n/locales/zh-CN.json +21 -2
  730. package/dist/i18n/locales/zh-HK.json +21 -2
  731. package/dist/i18n/locales/zh-TW.json +21 -2
  732. package/dist/i18n/regionHints.js +22 -22
  733. package/dist/i18n/regions.d.ts +73 -24
  734. package/dist/i18n/regions.js +57 -12
  735. package/dist/index.d.ts +191 -189
  736. package/dist/index.js +55 -54
  737. package/dist/llms-full.txt +7025 -5079
  738. package/dist/llms-medium.txt +486 -340
  739. package/dist/llms.txt +4 -3
  740. package/dist/locale-blueprint.json +24 -2
  741. package/dist/locale-tags.js +81 -0
  742. package/dist/mcp-sdk.LICENSES.txt +210 -0
  743. package/dist/mcp-sdk.mjs +78 -0
  744. package/dist/nuxt-auto-imports.d.ts +1 -1
  745. package/dist/nuxt-auto-imports.js +1 -1
  746. package/dist/nuxt-module.d.ts +5 -5
  747. package/dist/nuxt.js +20 -17
  748. package/dist/plugin.d.ts +2 -2
  749. package/dist/project-dts.d.ts +4 -4
  750. package/dist/project-dts.js +68 -62
  751. package/dist/setup-kit.LICENSES.txt +23 -0
  752. package/dist/setup-kit.mjs +9 -0
  753. package/dist/styles.css +2 -2
  754. package/dist/types/ActionButton.d.ts +3 -3
  755. package/dist/types/AlertVariant.d.ts +1 -1
  756. package/dist/types/BadgeVariant.d.ts +1 -1
  757. package/dist/types/ButtonVariant.d.ts +1 -1
  758. package/dist/types/CheckboxVariant.d.ts +2 -2
  759. package/dist/types/ColumnName.d.ts +1 -1
  760. package/dist/types/CommonProps.d.ts +25 -3
  761. package/dist/types/Config.d.ts +9 -9
  762. package/dist/types/ConfigDefaults.d.ts +37 -37
  763. package/dist/types/ConfirmVariant.d.ts +1 -1
  764. package/dist/types/DatePickerType.d.ts +29 -2
  765. package/dist/types/DatePickerType.js +6 -2
  766. package/dist/types/DropdownItemVariant.d.ts +1 -1
  767. package/dist/types/IndicatorVariant.d.ts +1 -1
  768. package/dist/types/InputVariant.d.ts +1 -1
  769. package/dist/types/ItemAccessor.d.ts +7 -1
  770. package/dist/types/ItemProps.d.ts +3 -3
  771. package/dist/types/ItemsProvider.d.ts +2 -2
  772. package/dist/types/Placement.d.ts +7 -2
  773. package/dist/types/RadioVariant.d.ts +2 -2
  774. package/dist/types/ShapeErased.d.ts +1 -1
  775. package/dist/types/TabsVariant.d.ts +1 -1
  776. package/dist/types/ToastVariant.d.ts +1 -1
  777. package/dist/types/TooltipVariant.d.ts +1 -1
  778. package/dist/types/fallthrough.d.ts +1 -1
  779. package/dist/types/passthrough.d.ts +17 -17
  780. package/dist/types/ptComponentMap.d.ts +16 -15
  781. package/dist/utilities/calendar/canonicalParts.d.ts +29 -0
  782. package/dist/utilities/calendar/canonicalParts.js +12 -0
  783. package/dist/utilities/calendar/digits.d.ts +18 -0
  784. package/dist/utilities/calendar/digits.js +26 -0
  785. package/dist/utilities/calendar/gregorian.d.ts +2 -0
  786. package/dist/utilities/calendar/gregorian.js +36 -0
  787. package/dist/utilities/calendar/index.d.ts +3 -0
  788. package/dist/utilities/calendar/index.js +1 -0
  789. package/dist/utilities/calendar/international.d.ts +19 -0
  790. package/dist/utilities/calendar/resolve.d.ts +32 -0
  791. package/dist/utilities/calendar/resolve.js +12 -0
  792. package/dist/utilities/calendar/runtime.d.ts +49 -0
  793. package/dist/utilities/calendar/types.d.ts +140 -0
  794. package/dist/utilities/calendar/types.js +83 -0
  795. package/dist/utilities/functions/convertDateValue.d.ts +15 -2
  796. package/dist/utilities/functions/convertDateValue.js +22 -17
  797. package/dist/utilities/functions/elementLabel.d.ts +1 -1
  798. package/dist/utilities/functions/extractDomContainer.d.ts +1 -1
  799. package/dist/utilities/functions/isDateDisabled.d.ts +9 -1
  800. package/dist/utilities/functions/isDateDisabled.js +38 -21
  801. package/dist/utilities/functions/itemProps.d.ts +1 -1
  802. package/dist/utilities/functions/normalizeDateBound.d.ts +45 -2
  803. package/dist/utilities/functions/normalizeDateBound.js +52 -11
  804. package/dist/utilities/functions/parseSize.d.ts +2 -2
  805. package/dist/utilities/functions/readableValue.d.ts +1 -1
  806. package/dist/utilities/functions/responsiveDefault.d.ts +1 -1
  807. package/dist/utilities/functions/slotKey.d.ts +1 -1
  808. package/dist/utilities/functions/toggleInput.d.ts +1 -1
  809. package/dist/utilities/functions/warnRemovedAttrs.d.ts +3 -3
  810. package/dist/utilities/functions/when.d.ts +1 -1
  811. package/dist/utilities/misc/autofocus.d.ts +2 -2
  812. package/dist/utilities/misc/listboxMetrics.d.ts +1 -1
  813. package/dist/utilities/misc/maskaDataOptions.d.ts +1 -1
  814. package/dist/utilities/misc/ssrStateInjectionKey.d.ts +1 -1
  815. package/dist/utilities/misc/ssrValue.d.ts +1 -1
  816. package/dist/utils/configDefaults.d.ts +11 -1
  817. package/dist/utils/configDefaults.js +73 -43
  818. package/dist/utils/copyData.d.ts +2 -2
  819. package/dist/utils/cssLayers.d.ts +1 -1
  820. package/dist/utils/focusVisibility.d.ts +1 -1
  821. package/dist/utils/injectLibraryStyles.d.ts +1 -1
  822. package/dist/utils/overlayEscapeStack.d.ts +1 -1
  823. package/dist/utils/passthrough.d.ts +1 -1
  824. package/dist/utils/passthroughDeduper.d.ts +1 -1
  825. package/dist/utils/releasedActivator.d.ts +20 -0
  826. package/dist/utils/releasedActivator.js +11 -0
  827. package/dist/utils/versionCheck.d.ts +1 -1
  828. package/dist/utils/versionCheck.js +1 -1
  829. package/dist/vite-plugin.d.ts +90 -32
  830. package/dist/vite.js +416 -341
  831. package/llms.txt +4 -3
  832. package/package.json +51 -19
  833. package/scripts/README.md +2 -1
  834. package/scripts/lib/agent-manifest.mjs +105 -22
  835. package/scripts/lib/agent-refresh.mjs +151 -0
  836. package/scripts/lib/agent-setup.mjs +679 -0
  837. package/scripts/lib/carousel-items-without-slide.mjs +263 -0
  838. package/scripts/lib/carousel-prop-or-local.mjs +117 -0
  839. package/scripts/lib/check-fix.mjs +1 -1
  840. package/scripts/lib/collapsible-trigger-aria.mjs +1 -1
  841. package/scripts/lib/css-class-check.mjs +3 -3
  842. package/scripts/lib/css-local-check.mjs +25 -17
  843. package/scripts/lib/css-surface-answer.mjs +117 -0
  844. package/scripts/lib/define-preset-copy.mjs +1 -1
  845. package/scripts/lib/distributed-alias.mjs +81 -0
  846. package/scripts/lib/doc-sections.mjs +12 -4
  847. package/scripts/lib/dropdown-default-slot.mjs +1 -1
  848. package/scripts/lib/eslint-disable.mjs +58 -2
  849. package/scripts/lib/eslint-plugin.d.ts +10 -1
  850. package/scripts/lib/eslint-plugin.mjs +542 -64
  851. package/scripts/lib/form-v-model.mjs +1 -1
  852. package/scripts/lib/hand-imported-styles.mjs +2 -2
  853. package/scripts/lib/hand-roll-hints.mjs +25 -3
  854. package/scripts/lib/helper-canon.mjs +4 -4
  855. package/scripts/lib/helpers-add.mjs +39 -24
  856. package/scripts/lib/hidden-label-placeholder.mjs +1 -1
  857. package/scripts/lib/idiom-scan.mjs +4 -4
  858. package/scripts/lib/is-direct-run.mjs +20 -0
  859. package/scripts/lib/items-provider-context.mjs +1 -1
  860. package/scripts/lib/linked-target.mjs +26 -2
  861. package/scripts/lib/local-components.mjs +2 -2
  862. package/scripts/lib/locale-check.mjs +109 -13
  863. package/scripts/lib/mcp-config.mjs +140 -75
  864. package/scripts/lib/mcp-sdk.mjs +199 -0
  865. package/scripts/lib/migrate-fix.mjs +3 -3
  866. package/scripts/lib/plugin-options-check.mjs +170 -0
  867. package/scripts/lib/pnp.mjs +165 -0
  868. package/scripts/lib/portal-names.mjs +4 -4
  869. package/scripts/lib/prefer-v-bb-dialog.mjs +1 -1
  870. package/scripts/lib/project-variant-dts.mjs +80 -15
  871. package/scripts/lib/reactive-v-model.mjs +2 -2
  872. package/scripts/lib/redundant-item-accessor.mjs +1 -1
  873. package/scripts/lib/renamed-item-field.mjs +1 -1
  874. package/scripts/lib/renamed-slot-prop.mjs +524 -0
  875. package/scripts/lib/rule-registry.mjs +1 -1
  876. package/scripts/lib/setup-edits.mjs +1845 -0
  877. package/scripts/lib/setup.mjs +440 -0
  878. package/scripts/lib/slot-key.mjs +1 -1
  879. package/scripts/lib/slot-renames.mjs +3 -3
  880. package/scripts/lib/squashed-slot-words.mjs +1 -1
  881. package/scripts/lib/tab-links.mjs +2 -2
  882. package/scripts/lib/text-null-value.mjs +1 -1
  883. package/scripts/lib/toolchain-check.mjs +3 -3
  884. package/scripts/lib/tooling-options.mjs +87 -0
  885. package/scripts/lib/unimported-components.mjs +1 -1
  886. package/scripts/lib/unstyled-variants.mjs +1 -1
  887. package/scripts/lib/valid-locale.mjs +119 -0
  888. package/scripts/lib/validate-bb-markup.mjs +146 -102
  889. package/scripts/lib/wrapper-props.mjs +2 -2
  890. package/dist/components/BbNumberInput/warroom/corpus.d.ts +0 -58
  891. package/dist/components/BbNumberInput/warroom/currency-verify.rows.d.ts +0 -28
  892. package/dist/components/BbNumberInput/warroom/currency.rows.d.ts +0 -2
  893. package/dist/components/BbNumberInput/warroom/harness.d.ts +0 -217
  894. package/dist/components/BbNumberInput/warroom/oracle.d.ts +0 -150
  895. package/dist/components/BbTable/warroom/harness.d.ts +0 -260
  896. package/dist/utilities/functions/pipe.d.ts +0 -3
  897. package/dist/utilities/functions/range.js +0 -7
  898. package/scripts/lib/check-queue.mjs +0 -102
  899. package/scripts/lib/component-attr-targets.ts +0 -123
  900. package/scripts/lib/component-tree.ts +0 -648
  901. package/scripts/lib/consumer-install.mjs +0 -64
  902. package/scripts/lib/css-class-surface.mjs +0 -328
  903. package/scripts/lib/css-color-resolve.mjs +0 -296
  904. package/scripts/lib/css-comment-text.mjs +0 -16
  905. package/scripts/lib/design-token-manifest.mjs +0 -506
  906. package/scripts/lib/ensure-manifest.mjs +0 -135
  907. package/scripts/lib/example-checks.mjs +0 -337
  908. package/scripts/lib/guide-claims.mjs +0 -452
  909. package/scripts/lib/manifest-pointers.mjs +0 -71
  910. package/scripts/lib/pack.mjs +0 -55
  911. package/scripts/lib/public-type-exports.mjs +0 -273
  912. package/scripts/lib/quiet-gate.mjs +0 -385
  913. package/scripts/lib/recipe-excerpts.mjs +0 -98
  914. package/scripts/lib/swap-noun.mjs +0 -33
  915. package/scripts/lib/token-color-mix.mjs +0 -114
@@ -0,0 +1,2897 @@
1
+ # BbCarousel — Implementation Source
2
+
3
+ > Full implementation for deep dives. For everyday usage read the typed contract: [../BbCarousel.md](../BbCarousel.md).
4
+
5
+ ## Template & Script
6
+
7
+ ```vue
8
+ <template>
9
+ <section
10
+ ref="root"
11
+ :aria-label="label || t('carousel.label').value"
12
+ :aria-roledescription="t('carousel.role').value"
13
+ class="bb-carousel"
14
+ :class="{
15
+ 'bb-carousel--autoplay': showPause(),
16
+ 'bb-carousel--bleed': bleeding,
17
+ 'bb-carousel--draggable': mounted && snapCount() > 1,
18
+ 'bb-carousel--dots-below': mounted && snapCount() > 1 && !imageSlides(),
19
+ 'bb-carousel--framed': !!(slots['slide:header'] || slots['slide:footer']),
20
+ 'bb-carousel--centred': centred,
21
+ 'bb-carousel--py': roomy,
22
+ 'bb-carousel--loop': looping(),
23
+ }"
24
+ :style="[localStyle, bleedStyle]"
25
+ v-bind="passthrough.rootAttrs"
26
+ @focusin="onFocusIn"
27
+ @focusout="onFocusOut"
28
+ @keydown="onKeydown"
29
+ @mouseenter="hovered = true"
30
+ @mouseleave="onMouseLeave"
31
+ >
32
+ <!-- The controls come before the slides in the tab order (APG): the
33
+ pill (the rotation control, then the dots), previous, next. They render once
34
+ mounted: before that nothing could drive them, and the server cannot
35
+ know how many positions there are. -->
36
+ <template v-if="mounted && snapCount() > 1">
37
+ <!-- The pill: the rotation control first (APG: first in the tab
38
+ order), then the dots, a "Slides" group of their own. Over MAX_DOTS
39
+ positions, a running window: MAX_DOTS dots around the current one, the
40
+ strip sliding under it, the edge dots shrunk while more lie beyond;
41
+ the rest are out of reach. One Tab stop for the dots: the current one
42
+ (the arrow keys move from there). -->
43
+ <div
44
+ class="bb-carousel__dots"
45
+ :class="{ 'bb-carousel__dots--window': windowed() }"
46
+ :style="windowed() ? { '--start': windowStart() } : undefined"
47
+ v-bind="passthrough.dots"
48
+ >
49
+ <button
50
+ v-if="showPause()"
51
+ :aria-label="
52
+ userPaused ? t('carousel.play').value : t('carousel.pause').value
53
+ "
54
+ class="bb-carousel__pause"
55
+ type="button"
56
+ v-bind="passthrough.pause"
57
+ @click="togglePlay"
58
+ >
59
+ <BbIcon :icon="userPaused ? playSvg : pauseSvg" size="10px" />
60
+ </button>
61
+ <div
62
+ :aria-label="t('carousel.slides').value"
63
+ class="bb-carousel__dot-list"
64
+ role="group"
65
+ >
66
+ <button
67
+ v-for="p in snapCount()"
68
+ :key="p"
69
+ :aria-current="p - 1 === shownPage || undefined"
70
+ :aria-label="t('carousel.goTo', pages[p - 1].first + 1).value"
71
+ class="bb-carousel__dot"
72
+ :class="[
73
+ { 'bb-carousel__dot--active': p - 1 === shownPage },
74
+ edgeClass(p - 1),
75
+ ]"
76
+ :inert="!inWindow(p - 1) || undefined"
77
+ :tabindex="p - 1 === shownPage ? 0 : -1"
78
+ type="button"
79
+ v-bind="
80
+ passthrough.part('dot', {
81
+ active: p - 1 === shownPage || undefined,
82
+ })
83
+ "
84
+ @click="goPage(p - 1, true)"
85
+ ></button>
86
+ </div>
87
+ </div>
88
+ <button
89
+ :aria-disabled="!canPrev() || undefined"
90
+ :aria-label="t('carousel.previous').value"
91
+ class="bb-carousel__arrow bb-carousel__prev"
92
+ type="button"
93
+ v-bind="passthrough.part('prev', { disabled: !canPrev() || undefined })"
94
+ @click="step(-1)"
95
+ >
96
+ <BbIcon :icon="chevronLeftSvg" size="50%" />
97
+ </button>
98
+ <button
99
+ :aria-disabled="!canNext() || undefined"
100
+ :aria-label="t('carousel.next').value"
101
+ class="bb-carousel__arrow bb-carousel__next"
102
+ type="button"
103
+ v-bind="passthrough.part('next', { disabled: !canNext() || undefined })"
104
+ @click="step(1)"
105
+ >
106
+ <BbIcon :icon="chevronRightSvg" size="50%" />
107
+ </button>
108
+ </template>
109
+
110
+ <!-- tabindex -1: a click on a slide's picture parks the focus here, so
111
+ the arrow keys work after it, without a Tab stop of its own (the
112
+ buttons and dots are the keyboard route). -->
113
+ <div
114
+ ref="track"
115
+ class="bb-carousel__track"
116
+ tabindex="-1"
117
+ @click.capture="onTrackClick"
118
+ @dragstart.prevent
119
+ @mousedown="onMouseDown"
120
+ @pointerdown="onPointerDown"
121
+ @scroll.passive="onScroll"
122
+ @scrollend="onScrollEnd"
123
+ @touchcancel.passive="onTouchEnd"
124
+ @touchend.passive="onTouchEnd"
125
+ @touchstart.passive="onTouchStart"
126
+ @wheel.passive="onWheel"
127
+ >
128
+ <!-- Rendered once per render: the slot runs once, not once per slide. -->
129
+ <template v-for="(list, li) in [slideList()]" :key="li">
130
+ <div
131
+ v-for="(entry, ci) in trackEntries(list)"
132
+ :key="entry.key"
133
+ :aria-hidden="entry.clone || undefined"
134
+ :aria-label="
135
+ entry.clone
136
+ ? undefined
137
+ : t('carousel.slideOf', entry.real + 1, list.length).value
138
+ "
139
+ :aria-roledescription="
140
+ entry.clone ? undefined : t('carousel.slideRole').value
141
+ "
142
+ class="bb-carousel__slide"
143
+ :class="{
144
+ 'bb-carousel__slide--active': isActive(entry.real),
145
+ 'bb-carousel__slide--current': isCurrent(entry.real),
146
+ 'bb-carousel__slide--clone': entry.clone,
147
+ // A snap point: a page starts here (every slide until mounted).
148
+ 'bb-carousel__slide--page': !mounted || isStartChild(ci),
149
+ }"
150
+ :inert="isInert(entry.real, entry.clone) || undefined"
151
+ :role="entry.clone ? undefined : 'group'"
152
+ v-bind="
153
+ passthrough.part('slide', {
154
+ active: isActive(entry.real) || undefined,
155
+ current: isCurrent(entry.real) || undefined,
156
+ })
157
+ "
158
+ >
159
+ <slot
160
+ v-if="slots['slide:header']"
161
+ :active="isActive(entry.real)"
162
+ :current="isCurrent(entry.real)"
163
+ :index="entry.real"
164
+ :item="entry.item as T"
165
+ name="slide:header"
166
+ />
167
+ <component :is="entry.node" v-if="entry.node" />
168
+ <slot
169
+ v-else-if="slots.slide"
170
+ :active="isActive(entry.real)"
171
+ :current="isCurrent(entry.real)"
172
+ :index="entry.real"
173
+ :item="entry.item as T"
174
+ name="slide"
175
+ />
176
+ <img
177
+ v-else-if="imageOf(entry.item)"
178
+ :alt="imageOf(entry.item)!.alt"
179
+ class="bb-carousel__image"
180
+ decoding="async"
181
+ draggable="false"
182
+ :loading="near(entry.real) ? undefined : 'lazy'"
183
+ :sizes="imageOf(entry.item)!.sizes"
184
+ :src="imageOf(entry.item)!.src"
185
+ :srcset="imageOf(entry.item)!.srcset"
186
+ v-bind="passthrough.image"
187
+ />
188
+ <slot
189
+ v-if="slots['slide:footer']"
190
+ :active="isActive(entry.real)"
191
+ :current="isCurrent(entry.real)"
192
+ :index="entry.real"
193
+ :item="entry.item as T"
194
+ name="slide:footer"
195
+ />
196
+ <!-- On top of any slide, moving with it. The layer lets taps
197
+ through where it is empty (the slide still swipes, drags and
198
+ peek-clicks there); its content takes them. -->
199
+ <div
200
+ v-if="slots.overlay"
201
+ class="bb-carousel__overlay"
202
+ v-bind="passthrough.overlay"
203
+ >
204
+ <slot
205
+ :active="isActive(entry.real)"
206
+ :current="isCurrent(entry.real)"
207
+ :index="entry.real"
208
+ :item="entry.item as T"
209
+ name="overlay"
210
+ />
211
+ </div>
212
+ </div>
213
+ </template>
214
+ </div>
215
+
216
+ <!-- Polite, and only for a move the user made: never while autoplay runs
217
+ (APG), never on mount. -->
218
+ <span aria-live="polite" class="bb-sr-only">{{ announcement }}</span>
219
+ </section>
220
+ </template>
221
+
222
+ <script lang="ts">
223
+ export type {
224
+ BbCarouselImage,
225
+ BbCarouselProps,
226
+ BbCarouselEvents,
227
+ BbCarouselSlots,
228
+ BbCarouselSlotProps,
229
+ } from './types';
230
+ </script>
231
+
232
+ <script setup lang="ts" generic="T = number">
233
+ import {
234
+ Comment,
235
+ Fragment,
236
+ Text,
237
+ cloneVNode,
238
+ computed,
239
+ nextTick,
240
+ onBeforeUnmount,
241
+ onMounted,
242
+ onUpdated,
243
+ ref,
244
+ useAttrs,
245
+ watch,
246
+ type VNode,
247
+ } from 'vue';
248
+ import type { FallthroughAttrs } from '@/types/fallthrough';
249
+ import BbIcon from '../BbIcon/BbIcon.vue';
250
+ import chevronLeftSvg from '@/assets/svgs/chevron_left.svg?raw';
251
+ import chevronRightSvg from '@/assets/svgs/chevron_right.svg?raw';
252
+ import pauseSvg from '@/assets/svgs/pause.svg?raw';
253
+ import playSvg from '@/assets/svgs/play.svg?raw';
254
+ import { usePassthrough } from '@/composables/usePassthrough';
255
+ import { useLocale } from '@/composables/useLocale';
256
+ import {
257
+ BB_CAROUSEL_PT,
258
+ type BbCarouselImage,
259
+ type BbCarouselProps,
260
+ type BbCarouselSlots,
261
+ } from './types';
262
+
263
+ defineOptions({ inheritAttrs: false });
264
+
265
+ /** The current slide: any slide, 0 to the last. The view shows the page
266
+ * that holds it; a value out of range is brought back in and written back. */
267
+ const current = defineModel<number>({ default: 0 });
268
+ // The element(s) the fall-through attributes reach, as typed below.
269
+ // @attrTargets section
270
+ const props = withDefaults(
271
+ defineProps<
272
+ BbCarouselProps<T> &
273
+ /* @vue-ignore */ FallthroughAttrs<'section', BbCarouselProps<T>>
274
+ >(),
275
+ {
276
+ items: undefined,
277
+ autoplay: false,
278
+ picker: false,
279
+ label: undefined,
280
+ // Left out, they set nothing: the CSS locals stay the consumer's.
281
+ perView: undefined,
282
+ bleed: undefined,
283
+ align: undefined,
284
+ }
285
+ );
286
+ const slots = defineSlots<BbCarouselSlots<T>>();
287
+ /** The snap position the view rests on (the slide sitting first): internal,
288
+ * one of the page starts. */
289
+ const index = ref(current.value);
290
+ const { t } = useLocale();
291
+
292
+ const passthrough = usePassthrough({
293
+ component: 'BbCarousel',
294
+ attrs: useAttrs(),
295
+ props,
296
+ parts: BB_CAROUSEL_PT.parts,
297
+ states: BB_CAROUSEL_PT.states,
298
+ active: {},
299
+ });
300
+
301
+ const root = ref<HTMLElement | null>(null);
302
+ const track = ref<HTMLElement | null>(null);
303
+ const mounted = ref(false);
304
+
305
+ // ---- Slides ----------------------------------------------------------------
306
+
307
+ type Slide = { key: PropertyKey; node?: VNode; item?: unknown };
308
+ type Entry = Slide & { real: number; clone: boolean };
309
+
310
+ /** One slide per child of the default slot (fragments and `v-for` flattened). */
311
+ const flatten = (nodes: VNode[]): VNode[] =>
312
+ nodes.flatMap((node) => {
313
+ if (node.type === Comment) return [];
314
+ if (node.type === Fragment) return flatten(node.children as VNode[]);
315
+ if (node.type === Text && !String(node.children).trim()) return [];
316
+ return [node];
317
+ });
318
+
319
+ /** A stable identity per entry of `items`, so slide state (a typed input, a
320
+ * playing video) follows its item when the list is reordered: the value
321
+ * itself for primitives (plus its occurrence), a private id for objects. */
322
+ const ids = new WeakMap<object, number>();
323
+ let nextId = 0;
324
+ const keysOf = (items: readonly unknown[]): PropertyKey[] => {
325
+ const seen = new Map<unknown, number>();
326
+ return items.map((item) => {
327
+ if (item !== null && typeof item === 'object') {
328
+ if (!ids.has(item)) ids.set(item, ++nextId);
329
+ return `o${ids.get(item)}`;
330
+ }
331
+ const n = (seen.get(item) ?? 0) + 1;
332
+ seen.set(item, n);
333
+ return `${typeof item}:${String(item)}:${n}`;
334
+ });
335
+ };
336
+
337
+ /** Read during render (once, see the template), so the slot's own
338
+ * reactivity drives it. */
339
+ const slideList = (): Slide[] => {
340
+ const { items } = props;
341
+ if (typeof items === 'number')
342
+ return Array.from({ length: Math.max(0, Math.floor(items)) }, (_, i) => ({
343
+ key: i,
344
+ item: i,
345
+ }));
346
+ if (items) {
347
+ const keys = keysOf(items);
348
+ return items.map((item, i) => ({ key: keys[i], item }));
349
+ }
350
+ // The default slot renders vnodes (its type says `unknown`, to keep the
351
+ // public slot types free of `any`).
352
+ return flatten((slots.default?.() ?? []) as VNode[]).map((node, i) => ({
353
+ key: node.key ?? i,
354
+ node,
355
+ }));
356
+ };
357
+
358
+ /** The slides the track renders: with `loop`, `lead` clones of the last
359
+ * slides before the real ones and `lead` of the first after them, so a move
360
+ * past either end keeps going and then jumps, unseen, to the real slide. */
361
+ const trackEntries = (list: Slide[]): Entry[] => {
362
+ const real = list.map((s, i) => ({ ...s, real: i, clone: false }));
363
+ const k = Math.min(lead.value, list.length);
364
+ if (!k) return real;
365
+ const copy = (s: Slide, i: number, side: string): Entry => ({
366
+ key: `${side}${String(s.key)}`,
367
+ node: s.node ? cloneVNode(s.node) : undefined,
368
+ item: s.item,
369
+ real: i,
370
+ clone: true,
371
+ });
372
+ return [
373
+ ...list.slice(-k).map((s, j) => copy(s, list.length - k + j, '<')),
374
+ ...real,
375
+ ...list.slice(0, k).map((s, j) => copy(s, j, '>')),
376
+ ];
377
+ };
378
+
379
+ /** The image an entry renders without a `slide` slot: a URL, or an object
380
+ * with a `src` or a `srcset` (`alt`, `sizes` optional). */
381
+ const imageOf = (item: unknown): BbCarouselImage | undefined => {
382
+ if (typeof item === 'string') return { src: item, alt: '' };
383
+ if (!item || typeof item !== 'object') return undefined;
384
+ const { src, srcset, sizes, alt } = item as Record<string, unknown>;
385
+ const str = (v: unknown) => (typeof v === 'string' ? v : undefined);
386
+ if (str(src) === undefined && str(srcset) === undefined) return undefined;
387
+ return {
388
+ src: str(src),
389
+ srcset: str(srcset),
390
+ sizes: str(sizes),
391
+ alt: alt == null ? '' : String(alt),
392
+ } as BbCarouselImage;
393
+ };
394
+
395
+ // ---- Geometry (DOM only: the server renders every slide, no controls) ------
396
+
397
+ /** Slides per view, from the root's `--per-view` (1 until mounted). */
398
+ const perView = ref(1);
399
+ /** Real slides (measured; the template counts the slot until mounted). */
400
+ const count = ref(0);
401
+ /** Snap positions the dots stand for: the slides that can sit first. */
402
+ const positions = ref(0);
403
+ /** Clones on each side of the real slides (loop only, measured). */
404
+ const lead = ref(0);
405
+ /** The child element nearest the snap edge: the current slide at rest, and
406
+ * mid-swipe or mid-move the one the reader is arriving at (a clone, with
407
+ * loop). The dots and the `active` look follow it live; `inert` waits for
408
+ * the move to settle. */
409
+ const shownChild = ref(index.value);
410
+ /** Distance the track spills past the root on each side (`bleed`). */
411
+ const bleedStart = ref(0);
412
+ const bleedEnd = ref(0);
413
+ /** The track's `scroll-padding-inline-start`, read in `measure()`. */
414
+ let padStart = 0;
415
+
416
+ /** `--align: center` (the `align` prop, or the local): the current slide
417
+ * sits in the middle of the column, its neighbours peeking on both sides. */
418
+ const centred = ref(false);
419
+ /** Centred: the room on each side of a slide in the column (measured). */
420
+ const centrePad = ref(0);
421
+ /** `--py` above 0: room above and below the slides (the corner mask). */
422
+ const roomy = ref(false);
423
+
424
+ /** Slides fully in view from the current one: a fractional peek stays out. */
425
+ const fullyVisible = () => Math.max(1, Math.floor(perView.value + 0.01));
426
+
427
+ // ---- Pages -------------------------------------------------------------------
428
+ // The view moves a page at a time: as many slides as are fully in view (one
429
+ // when centred). Page p holds slides p·k to p·k + k − 1; without loop the last
430
+ // page shows the last full view (9 slides, 2 per view: 1–2, 3–4, 5–6, 7–8,
431
+ // 8–9). The snap points are the page starts only, so a swipe lands on a page.
432
+
433
+ /** Slides per page (`picker`: one, every slide a snap point). */
434
+ const pageSize = () => (centred.value || props.picker ? 1 : fullyVisible());
435
+ /** Each page: its snap position (`start`) and the slide a step to it makes
436
+ * current (`first`). */
437
+ const pages = computed(() => {
438
+ const n = count.value;
439
+ const k = pageSize();
440
+ const out: Array<{ start: number; first: number }> = [];
441
+ if (!positions.value) return out;
442
+ for (let first = 0; first < n; first += k) {
443
+ const start = looping() ? first : Math.min(first, positions.value - 1);
444
+ if (out.length && out[out.length - 1].start === start) continue;
445
+ out.push({ start, first });
446
+ }
447
+ return out;
448
+ });
449
+ const starts = computed(() => new Set(pages.value.map((p) => p.start)));
450
+ const snapCount = () => pages.value.length;
451
+ /** The page that holds slide `c`. */
452
+ const pageOf = (c: number) => {
453
+ let p = 0;
454
+ pages.value.forEach((page, i) => {
455
+ if (page.first <= c) p = i;
456
+ });
457
+ return p;
458
+ };
459
+ /** The snap position that shows slide `c`: its page; with `picker`, the
460
+ * one that keeps it in the middle slot, the ends clamped (6 in view: slot 3,
461
+ * the strip at rest until then and at its end after). */
462
+ const viewFor = (c: number) => {
463
+ if (props.picker && !centred.value) {
464
+ const side = Math.floor((fullyVisible() - 1) / 2);
465
+ const n = count.value;
466
+ if (looping()) return (((c - side) % n) + n) % n;
467
+ return Math.min(Math.max(c - side, 0), positions.value - 1);
468
+ }
469
+ return pages.value[pageOf(c)]?.start ?? 0;
470
+ };
471
+ /** Child element `c` is a page start (a snap point). */
472
+ const isStartChild = (c: number) =>
473
+ lead.value ? starts.value.has(realOf(c)) : starts.value.has(c);
474
+ /** Slide `c` is fully in view with the view resting on position `pos`. */
475
+ const inView = (pos: number, c: number) => {
476
+ const n = count.value;
477
+ if (centred.value) return c === pos;
478
+ const v = fullyVisible();
479
+ if (looping()) return (((c - pos) % n) + n) % n < v;
480
+ const from = Math.min(pos, Math.max(0, n - v));
481
+ return c >= from && c < from + v;
482
+ };
483
+ /** The page the arrows count from: the one shown while the current slide
484
+ * is in it (nine at two, 8 clicked on the last view, 8–9: prev goes to
485
+ * 7–8), else the current slide's own. */
486
+ const curPage = () => {
487
+ const i = pages.value.findIndex((p) => p.start === index.value);
488
+ return i >= 0 && inView(index.value, current.value)
489
+ ? i
490
+ : pageOf(current.value);
491
+ };
492
+ /** The slide current once the view rests on `pos`: the current one while it
493
+ * stays in view, else the page's first. With `picker` a swipe only
494
+ * browses: the current one stays. */
495
+ const currentAt = (pos: number) =>
496
+ props.picker || inView(pos, current.value)
497
+ ? current.value
498
+ : (pages.value.find((p) => p.start === pos)?.first ?? pos);
499
+ /** The next page start from child `c` going `dir`, or `c` at the end. */
500
+ const nextStart = (c: number, dir: number) => {
501
+ const max = lead.value ? children().length - 1 : positions.value - 1;
502
+ for (let x = c + dir; x >= 0 && x <= max; x += dir)
503
+ if (isStartChild(x)) return x;
504
+ return c;
505
+ };
506
+ /** Centred: slides fully in view on each side of the current one. */
507
+ const sideVisible = () =>
508
+ centred.value ? Math.floor((perView.value - 1) / 2 + 0.01) : 0;
509
+ /** Slides fully in view in all: centred, the middle one and its sides. */
510
+ const visibleCount = () =>
511
+ centred.value ? 1 + 2 * sideVisible() : fullyVisible();
512
+
513
+ const children = () => Array.from(track.value?.children ?? []) as HTMLElement[];
514
+ /** The real slide `i`'s element (past the leading clones). */
515
+ const realEl = (i: number) => children()[i + lead.value];
516
+ const rtl = () =>
517
+ !!root.value && getComputedStyle(root.value).direction === 'rtl';
518
+
519
+ /** The scrollLeft at which an element sits first in view: on the track's
520
+ * snap edge, which `bleed` moves in by the scroll padding (negative in RTL). */
521
+ const startOf = (el: HTMLElement) =>
522
+ rtl()
523
+ ? el.offsetLeft + el.offsetWidth - track.value!.clientWidth + padStart
524
+ : el.offsetLeft - padStart;
525
+
526
+ const maxScroll = () =>
527
+ track.value ? track.value.scrollWidth - track.value.clientWidth : 0;
528
+
529
+ /** True while the track has no box (hidden in a tab, a closed dialog). */
530
+ const unmeasurable = () => !track.value || track.value.clientWidth === 0;
531
+
532
+ let lastSignature = '';
533
+ /** The last measure changed the layout it reads (see remeasure). */
534
+ let pendingLayout = false;
535
+
536
+ const measure = () => {
537
+ if (!root.value || !track.value) return;
538
+ measureBleed();
539
+ const n = children().length - 2 * lead.value;
540
+ count.value = Math.max(0, n);
541
+ // Hidden: nothing to read. Keep the index as it is; the ResizeObserver
542
+ // measures again when the carousel shows.
543
+ if (unmeasurable()) return;
544
+ perView.value = Math.max(
545
+ 1,
546
+ parseFloat(getComputedStyle(root.value).getPropertyValue('--per-view')) || 1
547
+ );
548
+ const first = realEl(0);
549
+ centred.value =
550
+ getComputedStyle(root.value).getPropertyValue('--align').trim() ===
551
+ 'center';
552
+ roomy.value =
553
+ parseFloat(getComputedStyle(root.value).getPropertyValue('--py')) > 0;
554
+ const pad =
555
+ centred.value && first
556
+ ? Math.max(0, (root.value.clientWidth - first.offsetWidth) / 2)
557
+ : 0;
558
+ if (Math.abs(pad - centrePad.value) > 0.5) {
559
+ centrePad.value = pad;
560
+ pendingLayout = true;
561
+ return; // the scroll padding moves: measured again after the render
562
+ }
563
+ padStart =
564
+ parseFloat(getComputedStyle(track.value).scrollPaddingInlineStart) || 0;
565
+ // Loop: enough clones to fill the track's whole width past either end.
566
+ if (props.loop && n > fullyVisible() && first) {
567
+ const gap = parseFloat(getComputedStyle(track.value).columnGap) || 0;
568
+ stepWidth = first.offsetWidth + gap;
569
+ // Two spare: a move may head up to one slide past either end of the
570
+ // real run, and the view around it must still be all slides.
571
+ const want = Math.min(
572
+ n,
573
+ Math.ceil(track.value.clientWidth / Math.max(1, stepWidth)) + 2
574
+ );
575
+ if (want !== lead.value) {
576
+ lead.value = want;
577
+ pendingLayout = true;
578
+ return; // re-renders; measured again after it
579
+ }
580
+ } else if (lead.value) {
581
+ lead.value = 0;
582
+ pendingLayout = true;
583
+ return;
584
+ }
585
+ if (props.loop && lead.value) positions.value = n;
586
+ else {
587
+ const max = maxScroll();
588
+ const els = children().slice(0, n);
589
+ const last = els.findIndex((el) => Math.abs(startOf(el)) >= max - 1);
590
+ positions.value = n === 0 ? 0 : last === -1 ? n : last + 1;
591
+ }
592
+ if (positions.value && index.value > positions.value - 1)
593
+ setIndex(positions.value - 1);
594
+ // A seeded value out of range (or slides removed under it): the current
595
+ // one is a slide that exists, written back.
596
+ if (n > 0) {
597
+ const c = current.value;
598
+ const ok = Number.isFinite(c)
599
+ ? Math.min(Math.max(Math.round(c), 0), n - 1)
600
+ : 0;
601
+ if (ok !== c) setCurrent(ok);
602
+ }
603
+ };
604
+
605
+ /** Re-measure, and put the current slide back on the snap edge when the
606
+ * geometry that places it changed (never while a finger or pointer holds
607
+ * the track; a height-only change, from a late image, moves nothing). */
608
+ const remeasure = () => {
609
+ pendingLayout = false;
610
+ measure();
611
+ // The measure changed what it measures (the centring pad, the clones):
612
+ // once that has rendered, measure again, so the pages and the view
613
+ // follow (an `align` switched mid-life).
614
+ if (pendingLayout) return void nextTick(remeasure);
615
+ if (unmeasurable() || held.value) return;
616
+ // Never re-snap under a running move (slides added mid-move would make it
617
+ // jump): the move's landing re-measures.
618
+ if (moving()) return void (remeasureOnLanding = true);
619
+ // The clones may have changed in number: the current slide's element too.
620
+ if (target === null) shownChild.value = index.value + lead.value;
621
+ const signature = [
622
+ track.value!.clientWidth,
623
+ perView.value,
624
+ lead.value,
625
+ bleedStart.value,
626
+ bleedEnd.value,
627
+ count.value,
628
+ positions.value,
629
+ centred.value,
630
+ centrePad.value,
631
+ ].join();
632
+ if (signature === lastSignature) return;
633
+ if (!pages.value.length) return void scrollTo(index.value);
634
+ lastSignature = signature;
635
+ // The pages may have changed (a breakpoint's `--per-view`): rest on the
636
+ // page that holds the current slide, unless it is in view where we are
637
+ // (a picker always seats it in its slot).
638
+ const keep =
639
+ !props.picker &&
640
+ starts.value.has(index.value) &&
641
+ inView(index.value, current.value);
642
+ const pos = keep ? index.value : viewFor(current.value);
643
+ setIndex(pos);
644
+ scrollTo(pos);
645
+ };
646
+
647
+ /** The real slide the view stands on, live. */
648
+ const shown = computed(() => realOf(shownChild.value));
649
+ /** The page the dots stand on, live. */
650
+ const shownPage = computed(() => {
651
+ let p = 0;
652
+ pages.value.forEach((page, i) => {
653
+ if (page.start <= shown.value) p = i;
654
+ });
655
+ return p;
656
+ });
657
+ /** The current slide, live: mid-swipe, the one it becomes if the swipe
658
+ * lands where it is heading. */
659
+ const shownCurrent = computed(() => currentAt(shown.value));
660
+
661
+ /** `active`, live: the slides fully in view from the one nearest the snap
662
+ * edge. By real slide, so a clone and its original share it: the
663
+ * unseen hop between them changes nothing on screen. Before mount every slide
664
+ * is active (the server cannot know `--per-view`). */
665
+ const isActive = (real: number) => {
666
+ if (!mounted.value) return true;
667
+ const n = count.value;
668
+ let d = real - shown.value;
669
+ // Loop: the shortest way round (a slide just before the first is near).
670
+ if (looping()) {
671
+ d = ((d % n) + n) % n;
672
+ if (d > n / 2) d -= n;
673
+ }
674
+ return d >= -sideVisible() && d < visibleCount() - sideVisible();
675
+ };
676
+ /** `current`: the `v-model` slide, live (mid-swipe, the one it becomes if the
677
+ * swipe lands where it is heading). Before mount, the `v-model` itself. */
678
+ const isCurrent = (real: number) =>
679
+ mounted.value ? real === shownCurrent.value : real === current.value;
680
+
681
+ /** Live (not inert): the real slides fully in view once the move settles. */
682
+ const isInert = (i: number, clone: boolean) => {
683
+ if (!mounted.value) return false;
684
+ if (clone) return true;
685
+ const start = index.value - sideVisible();
686
+ const end = start + visibleCount();
687
+ if (i >= start && i < end) return false;
688
+ // Loop: the slides past either end show again on the other side.
689
+ if (!(props.loop && lead.value > 0)) return true;
690
+ const n = count.value;
691
+ return !(i + n < end || i - n >= start);
692
+ };
693
+
694
+ // ---- Dots: a running window over many positions ---------------------------
695
+
696
+ /** Dots shown at once; more positions than this and the dots run. */
697
+ const MAX_DOTS = 7;
698
+ const windowed = () => snapCount() > MAX_DOTS;
699
+ /** The first position in the window: the current one centred, clamped. */
700
+ const windowStart = () =>
701
+ Math.min(
702
+ Math.max(shownPage.value - Math.floor(MAX_DOTS / 2), 0),
703
+ snapCount() - MAX_DOTS
704
+ );
705
+ const inWindow = (p: number) =>
706
+ !windowed() || (p >= windowStart() && p < windowStart() + MAX_DOTS);
707
+ /** The two dots at an edge with more beyond shrink: far, then near. */
708
+ const edgeClass = (p: number) => {
709
+ if (!windowed()) return undefined;
710
+ const start = windowStart();
711
+ const end = start + MAX_DOTS - 1;
712
+ const fromEdge = Math.min(
713
+ start > 0 ? p - start : Infinity,
714
+ end < snapCount() - 1 ? end - p : Infinity
715
+ );
716
+ if (fromEdge === 0) return 'bb-carousel__dot--far';
717
+ if (fromEdge === 1) return 'bb-carousel__dot--near';
718
+ return undefined;
719
+ };
720
+
721
+ /** In view, peeking (`bleed`), or one slide either side: fetched now, so a
722
+ * swipe lands on a loaded image; the rest load lazily as the track nears. */
723
+ const peekSlides = () => {
724
+ const first = mounted.value ? realEl(0) : undefined;
725
+ if (!first || !(bleedStart.value || bleedEnd.value)) return 0;
726
+ return Math.ceil(
727
+ Math.max(bleedStart.value, bleedEnd.value) / Math.max(1, first.offsetWidth)
728
+ );
729
+ };
730
+ const near = (i: number) => {
731
+ const reach = 1 + peekSlides();
732
+ // Centred, the view spreads on both sides of the current slide.
733
+ const side = centred.value ? Math.ceil((perView.value - 1) / 2) : 0;
734
+ const from = index.value - side - reach;
735
+ const to = centred.value
736
+ ? index.value + side + reach
737
+ : index.value + Math.ceil(perView.value - 0.01) - 1 + reach;
738
+ if (i >= from && i <= to) return true;
739
+ // Loop: the far end is next door too.
740
+ if (!props.loop || !count.value) return false;
741
+ return i - count.value >= from || i + count.value <= to;
742
+ };
743
+
744
+ /** Every slide is a built-in image (`items` of photos, no `slide` slot):
745
+ * the only case the dots sit over the slides. Over cards or markup they
746
+ * would land on the content, so there they sit below. */
747
+ const imageSlides = () =>
748
+ Array.isArray(props.items) &&
749
+ props.items.length > 0 &&
750
+ !slots.slide &&
751
+ // A header or footer adds content of its own: the slide is no longer
752
+ // only a photo, and laid-over dots would land on it.
753
+ !slots['slide:header'] &&
754
+ !slots['slide:footer'] &&
755
+ props.items.every((item) => imageOf(item) !== undefined);
756
+
757
+ // Template helpers (render-time).
758
+ /** Endless and actually looping: clones are rendered on both sides. */
759
+ const looping = () => !!props.loop && lead.value > 0;
760
+ const canPrev = () =>
761
+ props.loop || (props.picker ? current.value : curPage()) > 0;
762
+ const canNext = () =>
763
+ props.loop ||
764
+ (props.picker
765
+ ? current.value < count.value - 1
766
+ : curPage() < snapCount() - 1);
767
+
768
+ // ---- Moving ----------------------------------------------------------------
769
+
770
+ const reducedMotion = () =>
771
+ typeof window !== 'undefined' &&
772
+ !!window.matchMedia?.('(prefers-reduced-motion: reduce)').matches;
773
+
774
+ /** The child element a move is heading to; scroll events in between do not
775
+ * set the index. A finger, a wheel or a pointer on the track clears it. */
776
+ let target: number | null = null;
777
+ /** A user move announces where it lands, once it lands. */
778
+ let pendingAnnounce = false;
779
+ const announcement = ref('');
780
+
781
+ /** Snap is off with no move running: a gesture caught a move mid-way (or a
782
+ * mouse drags the track). When the gesture ends, `settle()` glides to the
783
+ * nearest snap point, which turns snapping back on, so nothing ever jumps to
784
+ * a snap point under the reader. */
785
+ let free = false;
786
+
787
+ // ---- The move ----------------------------------------------------------------
788
+ // As Swiper does, on the compositor: a move is a transform animation, so a
789
+ // busy page (a re-render, an image decoding, other widgets) never stalls it.
790
+ // The scroll position goes straight to the destination; every slide then
791
+ // animates from where it was shown back
792
+ // to its place (FLIP), with the Web Animations API.
793
+ //
794
+ // The curve, matched to Swiper by measurement:
795
+ // a fixed `--speed` (300ms) on cubic-bezier(.25, .25k, .25, 1). From rest
796
+ // k = 0.4, exactly CSS `ease`, Swiper's curve. A move that starts while the
797
+ // track already moves (a press mid-move, a released drag heading the same way)
798
+ // sets k so it starts at that speed: no dip, no kick, no stop. It lands exactly
799
+ // at `--speed`.
800
+
801
+ /** Something changed the geometry during a move: re-measure on landing. */
802
+ let remeasureOnLanding = false;
803
+
804
+ /** The running move's animations (one per slide), or none. */
805
+ let anims: Animation[] = [];
806
+ const moving = () => anims.length > 0;
807
+ let moveFrom = 0;
808
+ /** Where the move is heading (scrollLeft). */
809
+ let moveTo = 0;
810
+ let moveMs = 300;
811
+ /** The curve's starting slope (see above). */
812
+ let moveK = 0.4;
813
+ /** Distance between two neighbouring slides, measured. */
814
+ let stepWidth = 0;
815
+ /** The running move's keyframes and timing, for slides added mid-move. */
816
+ let moveFrames: Parameters<HTMLElement['animate']>[0] = [];
817
+ let moveTiming: Parameters<HTMLElement['animate']>[1] = {};
818
+
819
+ /** Slides added mid-move join it, at the same point in time. */
820
+ const joinMove = () => {
821
+ if (!moving()) return;
822
+ const now = anims[0].currentTime;
823
+ const have = new Set(anims.map((a) => (a.effect as KeyframeEffect).target));
824
+ children().forEach((child) => {
825
+ if (have.has(child)) return;
826
+ const a = child.animate(moveFrames, moveTiming);
827
+ a.currentTime = now;
828
+ anims.push(a);
829
+ });
830
+ };
831
+
832
+ /** cubic-bezier(.25, .25k, .25, 1) at time fraction `t`: progress and its
833
+ * slope (progress per unit of time). */
834
+ const curve = (t: number, k: number) => {
835
+ // x1 = x2 = 0.25 make x(s) = 0.75·s(1−s) + s³, monotonic on [0, 1].
836
+ const x = (u: number) => 0.75 * u * (1 - u) + u ** 3;
837
+ const dx = (u: number) => 0.75 * (1 - 2 * u) + 3 * u * u;
838
+ // Solve x(s) = t: Newton, then bisection if it did not converge.
839
+ let s = t;
840
+ for (let i = 0; i < 8; i++) {
841
+ const e = x(s) - t;
842
+ if (Math.abs(e) < 1e-6) break;
843
+ const d = dx(s);
844
+ if (d < 1e-6) break;
845
+ s = Math.min(1, Math.max(0, s - e / d));
846
+ }
847
+ if (Math.abs(x(s) - t) > 1e-4) {
848
+ let lo = 0;
849
+ let hi = 1;
850
+ for (let i = 0; i < 30; i++) {
851
+ s = (lo + hi) / 2;
852
+ if (x(s) < t) lo = s;
853
+ else hi = s;
854
+ }
855
+ }
856
+ // y1 = 0.25k, y2 = 1.
857
+ const y1 = 0.25 * k;
858
+ const p = 3 * (1 - s) ** 2 * s * y1 + 3 * (1 - s) * s * s + s ** 3;
859
+ const dy = 3 * (1 - s) ** 2 * y1 + 6 * (1 - s) * s * (1 - y1);
860
+ return { p, slope: dx(s) > 1e-6 ? dy / dx(s) : k };
861
+ };
862
+
863
+ /** The root's `--speed` local (one move), in ms. */
864
+ const speedMs = () => {
865
+ if (!root.value) return 300;
866
+ const raw = getComputedStyle(root.value).getPropertyValue('--speed').trim();
867
+ const n = parseFloat(raw);
868
+ if (!Number.isFinite(n)) return 300;
869
+ return raw.endsWith('ms') ? n : raw.endsWith('s') ? n * 1000 : n;
870
+ };
871
+
872
+ const snapOff = (off: boolean) => {
873
+ if (track.value) track.value.style.scrollSnapType = off ? 'none' : '';
874
+ };
875
+
876
+ /** Where the running move shows the track (scrollLeft terms), and its speed
877
+ * (px/s). */
878
+ const moveState = () => {
879
+ const t = Math.min(
880
+ 1,
881
+ Math.max(0, Number(anims[0]?.currentTime ?? moveMs) / moveMs)
882
+ );
883
+ const c = curve(t, moveK);
884
+ return {
885
+ at: moveFrom + (moveTo - moveFrom) * c.p,
886
+ speed: ((moveTo - moveFrom) * c.slope) / (moveMs / 1000),
887
+ };
888
+ };
889
+
890
+ const dropAnims = () => {
891
+ const old = anims;
892
+ anims = [];
893
+ old.forEach((a) => a.cancel());
894
+ };
895
+
896
+ /** Cancel a running move and any gesture state: the track stays where its
897
+ * scroll position is (the destination), snapping on. */
898
+ const stopMove = () => {
899
+ dropAnims();
900
+ free = false;
901
+ snapOff(false);
902
+ };
903
+
904
+ /** A finger, a dragging mouse or a wheel takes over a running move: the track
905
+ * stays exactly where the move shows it, snapping off. */
906
+ const catchMove = () => {
907
+ if (!moving() || !track.value) return;
908
+ const { at } = moveState();
909
+ snapOff(true);
910
+ dropAnims();
911
+ track.value.scrollLeft = at;
912
+ free = true;
913
+ };
914
+
915
+ const userMove = () => {
916
+ catchMove();
917
+ target = null;
918
+ kick();
919
+ };
920
+
921
+ /** Move the track to `left`. `velocity` (px/s): the speed a released drag let
922
+ * go with; a running move keeps its own. A speed pointing away from `left`
923
+ * is dropped. `shift`: the px the start moves by when a loop aims at the real
924
+ * slide a clone copies (the motion stays the same). */
925
+ const animateTo = (goal: number, velocity?: number, shift = 0) => {
926
+ const el = track.value;
927
+ if (!el) return;
928
+ // Where the scroll can actually go: the last slides of a row stop on its
929
+ // end (they never reach the start edge). Animating towards the unreachable
930
+ // start drew the row that far past the end for a frame, then slid it back:
931
+ // a twitch on every push against the end.
932
+ const max = maxScroll();
933
+ const left = Math.sign(goal) * Math.min(Math.abs(goal), max);
934
+ const ms = speedMs();
935
+ if (reducedMotion() || ms <= 0) {
936
+ stopMove();
937
+ el.scrollTo({ left, behavior: 'instant' });
938
+ return;
939
+ }
940
+ // Same goal while moving: nothing changes (Swiper: a no-op).
941
+ if (moving() && Math.abs(left - moveTo) < 0.5 && !shift) return;
942
+ const now = moving() ? moveState() : null;
943
+ const from = (now ? now.at : el.scrollLeft) + shift;
944
+ const v = now ? now.speed : (velocity ?? 0);
945
+ const d = left - from;
946
+ dropAnims();
947
+ free = false;
948
+ // Snapping off while the slides animate: snap points follow the slides'
949
+ // transformed boxes, so the browser would re-snap the scroll position after
950
+ // them and double the motion. Back on when the move lands, on a snap point.
951
+ snapOff(true);
952
+ if (Math.abs(left - el.scrollLeft) >= 0.5)
953
+ el.scrollTo({ left, behavior: 'instant' });
954
+ if (Math.abs(d) < 0.5) {
955
+ snapOff(false);
956
+ return void settle();
957
+ }
958
+ moveFrom = from;
959
+ moveTo = left;
960
+ moveMs = ms;
961
+ moveK = Math.min(4, Math.max(0.4, (v * (ms / 1000)) / d));
962
+ // Shown at `from`: the content sits `d` further on at `left`, so each slide
963
+ // starts translated back by `d` (the same sign in RTL: the scroll offset and
964
+ // the content move opposite ways in both directions).
965
+ // `translate`, not `transform`: it adds to a transform the consumer set on
966
+ // the slides (a scale on the inactive ones) instead of overwriting it.
967
+ moveFrames = [{ translate: `${d}px 0` }, { translate: '0px 0' }];
968
+ moveTiming = {
969
+ duration: ms,
970
+ easing: `cubic-bezier(0.25, ${(0.25 * moveK).toFixed(4)}, 0.25, 1)`,
971
+ };
972
+ const batch = children().map((child) =>
973
+ child.animate(moveFrames, moveTiming)
974
+ );
975
+ // A press mid-move: count from the frame already on screen (as a CSS
976
+ // transition does). A pending animation would start at the NEXT frame's
977
+ // time and paint the position the last frame showed: one frame standing
978
+ // still. From rest the timeline may be stale (no frames drawn for a
979
+ // while), so a fresh move keeps the browser's own start.
980
+ const tl = document.timeline?.currentTime;
981
+ if (now && tl != null) batch.forEach((a) => (a.startTime = Number(tl)));
982
+ anims = batch;
983
+ batch[0].onfinish = () => {
984
+ if (anims !== batch) return;
985
+ anims = [];
986
+ snapOff(false);
987
+ settle();
988
+ if (remeasureOnLanding) {
989
+ remeasureOnLanding = false;
990
+ remeasure();
991
+ }
992
+ };
993
+ };
994
+
995
+ /** With loop, keep the scroll position among the real slides: past either
996
+ * end, hop by one full run (the clones there are identical, and the active
997
+ * look follows the real slide, so nothing changes on screen). Returns the hop
998
+ * in px. */
999
+ /** The slides the last `wrap()` hopped by (±count). */
1000
+ let lastShift = 0;
1001
+ const wrap = (at = track.value?.scrollLeft ?? 0): number => {
1002
+ if (!lead.value || !track.value) return 0;
1003
+ const n = count.value;
1004
+ const els = children();
1005
+ const a = els[lead.value];
1006
+ const b = els[lead.value + n];
1007
+ if (!a || !b) return 0;
1008
+ const base = startOf(a);
1009
+ const span = startOf(b) - base;
1010
+ if (!span) return 0;
1011
+ const rel = (at - base) / span;
1012
+ let shift = 0;
1013
+ if (rel >= 1 - 1e-3) shift = -n;
1014
+ else if (rel < -1e-3) shift = n;
1015
+ if (!shift) return 0;
1016
+ const hop = (shift / n) * span;
1017
+ lastShift = shift;
1018
+ track.value.scrollLeft = at + hop;
1019
+ shownChild.value += shift;
1020
+ if (target !== null) target += shift;
1021
+ return hop;
1022
+ };
1023
+
1024
+ /** The view's snap position. */
1025
+ const setIndex = (i: number) => {
1026
+ index.value = i;
1027
+ shownChild.value = i + lead.value;
1028
+ };
1029
+
1030
+ /** Our own v-model writes; the watcher below only follows writes from
1031
+ * outside. A parent-controlled v-model echoes our write back later, as a
1032
+ * prop: the last value we wrote is ours too, not a new instruction. */
1033
+ let internal = false;
1034
+ let lastWritten: number | null = null;
1035
+ const setCurrent = (c: number) => {
1036
+ if (c === current.value) return;
1037
+ internal = true;
1038
+ lastWritten = c;
1039
+ current.value = c;
1040
+ internal = false;
1041
+ };
1042
+
1043
+ /** Put real slide `i` on the snap edge at once (a re-measure, a hop). */
1044
+ const scrollTo = (i: number) => {
1045
+ const el = children()[i + lead.value];
1046
+ if (!el || !track.value) return;
1047
+ stopMove();
1048
+ const left = startOf(el);
1049
+ if (Math.abs(track.value.scrollLeft - left) >= 1)
1050
+ track.value.scrollTo({ left, behavior: 'instant' });
1051
+ };
1052
+
1053
+ /** Announce slide `i`, or the current one as it reads once the parent has
1054
+ * taken our write (a parent-bound v-model updates on its next render). */
1055
+ const announce = (i?: number) => {
1056
+ if (running.value) return;
1057
+ // Cleared first, so the same text twice is read twice.
1058
+ announcement.value = '';
1059
+ void nextTick(
1060
+ () =>
1061
+ (announcement.value = t(
1062
+ 'carousel.slideOf',
1063
+ (i ?? current.value) + 1,
1064
+ count.value
1065
+ ).value)
1066
+ );
1067
+ };
1068
+
1069
+ /** Go to page `p` (clamped): its first slide becomes current (with
1070
+ * `picker` a dot only browses). */
1071
+ const goPage = (p: number, user = false) => {
1072
+ const list = pages.value;
1073
+ if (!list.length) return;
1074
+ const page = list[Math.min(Math.max(p, 0), list.length - 1)];
1075
+ if (user) kick();
1076
+ if (!props.picker) setCurrent(page.first);
1077
+ head(page.start + lead.value, user);
1078
+ };
1079
+
1080
+ /** Make slide `c` current (wrapped with loop, else clamped) and bring it
1081
+ * into view. */
1082
+ const select = (c: number, user = false) => {
1083
+ const n = count.value;
1084
+ if (!n) return;
1085
+ const next = props.loop ? ((c % n) + n) % n : Math.min(Math.max(c, 0), n - 1);
1086
+ if (user) kick();
1087
+ const was = current.value;
1088
+ setCurrent(next);
1089
+ reveal(next, user && next !== was);
1090
+ };
1091
+
1092
+ /** Head for child element `c` (a real slide or, with loop, a clone). */
1093
+ const head = (c: number, user: boolean, velocity?: number) => {
1094
+ const n = count.value;
1095
+ const real = (((c - lead.value) % n) + n) % n;
1096
+ target = c;
1097
+ setIndex(real);
1098
+ shownChild.value = c;
1099
+ pendingAnnounce = user;
1100
+ if (!track.value || !children().length) return;
1101
+ // Loop: aim at the real slide a clone copies when the move's start, shifted
1102
+ // by the same run, is still among the rendered slides (the motion is the
1103
+ // same; nothing has to hop at the end). Otherwise aim at the clone itself.
1104
+ let shift = 0;
1105
+ if (lead.value) {
1106
+ const n = count.value;
1107
+ let k = 0;
1108
+ while (c + k < lead.value) k += n;
1109
+ while (c + k >= lead.value + n) k -= n;
1110
+ if (k) {
1111
+ const px = leftOf(c + k) - leftOf(c);
1112
+ const from = (moving() ? moveState().at : track.value.scrollLeft) + px;
1113
+ const els = children();
1114
+ const lo = Math.min(startOf(els[0]), startOf(els[els.length - 1]));
1115
+ const hi = Math.max(startOf(els[0]), startOf(els[els.length - 1]));
1116
+ if (from >= lo - 1 && from <= hi + 1) {
1117
+ c += k;
1118
+ shift = px;
1119
+ target = c;
1120
+ shownChild.value = c;
1121
+ } else c = Math.min(Math.max(c, 0), els.length - 1);
1122
+ }
1123
+ }
1124
+ const left = leftOf(c);
1125
+ if (!moving() && Math.abs(track.value.scrollLeft - left) < 1) {
1126
+ free = false;
1127
+ snapOff(false);
1128
+ return arrive();
1129
+ }
1130
+ animateTo(left, velocity, shift);
1131
+ };
1132
+
1133
+ /** The scroll position that puts child `c` on the snap edge. With loop, `c`
1134
+ * may lie past the rendered clones (quick presses add up): one slide on per
1135
+ * step from the real run. */
1136
+ const leftOf = (c: number) => {
1137
+ const els = children();
1138
+ if (els[c]) return startOf(els[c]);
1139
+ const a = els[lead.value];
1140
+ const b = els[lead.value + count.value];
1141
+ if (!a || !b) return startOf(els[Math.max(0, Math.min(c, els.length - 1))]);
1142
+ return (
1143
+ startOf(a) + ((c - lead.value) * (startOf(b) - startOf(a))) / count.value
1144
+ );
1145
+ };
1146
+
1147
+ /** A page on or back; its first slide becomes current. */
1148
+ const step = (delta: number, user = true) => {
1149
+ const list = pages.value;
1150
+ if (!list.length) return;
1151
+ // A picker steps one slide: the next one becomes current.
1152
+ if (props.picker) return select(current.value + delta, user);
1153
+ if (user) kick();
1154
+ if (looping()) {
1155
+ // From where the running move is heading, not where it started: quick
1156
+ // presses add up, as far as they go (the goal may lie past the clones;
1157
+ // the animation hops back among the real slides as it goes). One page
1158
+ // start on, in child terms (the pages of a run that does not divide
1159
+ // evenly are not all the same size).
1160
+ let c = target ?? index.value + lead.value;
1161
+ do c += delta;
1162
+ while (!starts.value.has(realOf(c)));
1163
+ setCurrent(realOf(c));
1164
+ head(c, user);
1165
+ return;
1166
+ }
1167
+ const last = list.length - 1;
1168
+ const p = curPage();
1169
+ let next = p + delta;
1170
+ if (next < 0) next = props.loop ? last : 0;
1171
+ if (next > last) next = props.loop ? 0 : last;
1172
+ if (next === p) return;
1173
+ // Loop without clones (too few slides to need them): wrap at once.
1174
+ if (Math.abs(next - p) > 1) {
1175
+ target = null;
1176
+ setCurrent(list[next].first);
1177
+ setIndex(list[next].start);
1178
+ scrollTo(list[next].start);
1179
+ if (user) announce(list[next].first);
1180
+ return;
1181
+ }
1182
+ goPage(next, user);
1183
+ };
1184
+
1185
+ /** Bring slide `c` (now current) into view: no move while it is in view
1186
+ * already, else to the page that holds it. A picker follows it
1187
+ * (see viewFor). `user` announces it. */
1188
+ const reveal = (c: number, user = false) => {
1189
+ if (!pages.value.length) return;
1190
+ // Never under a finger or a dragging mouse (a shared v-model's autoplay,
1191
+ // say): the gesture decides where it lands.
1192
+ if (held.value || dragging) return;
1193
+ const pos = viewFor(c);
1194
+ if (props.picker ? pos === index.value : inView(index.value, c)) {
1195
+ if (user) announce(c);
1196
+ return;
1197
+ }
1198
+ let goal = pos + lead.value;
1199
+ // Loop: the nearest way round, on through the clones, never a rewind.
1200
+ if (looping()) {
1201
+ const n = count.value;
1202
+ const from = target ?? index.value + lead.value;
1203
+ for (const alt of [goal - n, goal + n])
1204
+ if (Math.abs(alt - from) < Math.abs(goal - from)) goal = alt;
1205
+ }
1206
+ head(goal, user);
1207
+ };
1208
+
1209
+ /** A move we started reached its goal. A clone hands over, unseen, to the
1210
+ * real slide it copies. */
1211
+ const arrive = () => {
1212
+ const c = target;
1213
+ target = null;
1214
+ if (c !== null && lead.value) {
1215
+ const real = c - lead.value;
1216
+ if (real < 0 || real >= count.value) {
1217
+ scrollTo(index.value);
1218
+ shownChild.value = index.value + lead.value;
1219
+ }
1220
+ }
1221
+ if (pendingAnnounce) announce();
1222
+ pendingAnnounce = false;
1223
+ };
1224
+
1225
+ /** The page start (a child element) nearest the scroll position. */
1226
+ const nearestChild = () => {
1227
+ if (!track.value) return 0;
1228
+ const at = track.value.scrollLeft;
1229
+ if (!lead.value && Math.abs(at) >= maxScroll() - 1)
1230
+ return pages.value[pages.value.length - 1]?.start ?? positions.value - 1;
1231
+ const els = children();
1232
+ let nearest = -1;
1233
+ els.forEach((el, i) => {
1234
+ if (!isStartChild(i)) return;
1235
+ if (
1236
+ nearest < 0 ||
1237
+ Math.abs(startOf(el) - at) < Math.abs(startOf(els[nearest]) - at)
1238
+ )
1239
+ nearest = i;
1240
+ });
1241
+ return Math.max(0, nearest);
1242
+ };
1243
+ const realOf = (c: number) => {
1244
+ const n = count.value;
1245
+ return n ? (((c - lead.value) % n) + n) % n : 0;
1246
+ };
1247
+
1248
+ /** The scroll came to rest: the index is the snap position nearest to it. */
1249
+ const settle = () => {
1250
+ clearTimeout(settleTimer);
1251
+ wheelCaught = false;
1252
+ if (!track.value || !positions.value || dragging || moving()) return;
1253
+ // A gesture that caught a move has ended: glide to the nearest snap point.
1254
+ if (free) {
1255
+ if (held.value) return;
1256
+ const c = nearestChild();
1257
+ // (A parent-bound v-model takes our write on its next render: compare
1258
+ // what we write, not what `current` reads back.)
1259
+ const now = currentAt(realOf(c));
1260
+ const changed = now !== current.value;
1261
+ setCurrent(now);
1262
+ head(c, changed);
1263
+ return;
1264
+ }
1265
+ const at = track.value.scrollLeft;
1266
+ // A move we started settles only where it was going: Chrome also fires
1267
+ // `scrollend` for a smooth scroll that a newer one interrupted. Where the
1268
+ // goal can actually sit: the last slides stop at the end.
1269
+ if (target !== null) {
1270
+ const start = leftOf(target);
1271
+ const reachable = Math.sign(start) * Math.min(Math.abs(start), maxScroll());
1272
+ if (Math.abs(reachable - at) > 1) return;
1273
+ arrive();
1274
+ return;
1275
+ }
1276
+ const c = nearestChild();
1277
+ const real = realOf(c);
1278
+ // A swipe that ended on a clone: jump, unseen, to the real slide.
1279
+ if (lead.value && (c < lead.value || c >= lead.value + count.value))
1280
+ scrollTo(real);
1281
+ // A swipe: the current slide stays while it is still in view, else the
1282
+ // page landed on hands it its first slide.
1283
+ const now = currentAt(real);
1284
+ setIndex(real);
1285
+ if (now !== current.value) {
1286
+ setCurrent(now);
1287
+ announce(now);
1288
+ }
1289
+ kick();
1290
+ };
1291
+
1292
+ // `scrollend` where the browser has it; a short quiet period elsewhere. The
1293
+ // dots follow a swipe as it goes, not only once it rests.
1294
+ let settleTimer: ReturnType<typeof setTimeout> | undefined;
1295
+ /** A wheel caught a move: the next `scrollend` waits for the quiet period. */
1296
+ let wheelCaught = false;
1297
+ const onScrollEnd = () => {
1298
+ if (!wheelCaught) settle();
1299
+ };
1300
+ let frame = 0;
1301
+ const onScroll = () => {
1302
+ clearTimeout(settleTimer);
1303
+ settleTimer = setTimeout(settle, 150);
1304
+ if (target !== null || frame) return;
1305
+ frame = requestAnimationFrame(() => {
1306
+ frame = 0;
1307
+ if (target === null && positions.value) shownChild.value = nearestChild();
1308
+ });
1309
+ };
1310
+
1311
+ // A v-model write from outside: brought into range (written back), then
1312
+ // into view (the page that holds it, unless it is in view already).
1313
+ watch(
1314
+ current,
1315
+ (c) => {
1316
+ if (internal || !mounted.value) return;
1317
+ // The echo of our own write, once: after it the same value from outside
1318
+ // is a new instruction (a shared v-model coming back to it).
1319
+ if (c === lastWritten) return void (lastWritten = null);
1320
+ const n = count.value;
1321
+ if (!n) return;
1322
+ const clamped = Number.isFinite(c)
1323
+ ? Math.min(Math.max(Math.round(c), 0), n - 1)
1324
+ : 0;
1325
+ if (clamped !== c) setCurrent(clamped);
1326
+ reveal(clamped);
1327
+ },
1328
+ { flush: 'sync' }
1329
+ );
1330
+
1331
+ // Focus never lands in limbo: a focused dot the window leaves, or anything
1332
+ // inside a slide about to go inert, hands the focus on (checked before the
1333
+ // render that changes them).
1334
+ watch(index, () => {
1335
+ const el = document.activeElement as HTMLElement | null;
1336
+ if (!el || !root.value?.contains(el)) return;
1337
+ if (el.classList.contains('bb-carousel__dot')) {
1338
+ void nextTick(() =>
1339
+ root.value
1340
+ ?.querySelectorAll<HTMLElement>('.bb-carousel__dot')
1341
+ [shownPage.value]?.focus({ preventScroll: true })
1342
+ );
1343
+ return;
1344
+ }
1345
+ if (el.closest('.bb-carousel__slide'))
1346
+ void nextTick(() => {
1347
+ // Unless the focus already moved on (the arrow keys hand it to the
1348
+ // current slide).
1349
+ if (document.activeElement !== el) return;
1350
+ if (el.closest('[inert]') || !el.isConnected)
1351
+ track.value?.focus({ preventScroll: true });
1352
+ });
1353
+ });
1354
+
1355
+ // ---- Pointer drag: the mouse always; a finger or pen only with `loop` -----
1356
+ // Without loop, touch and trackpads scroll the track natively and nothing
1357
+ // here writes the scroll position. With loop a touch must not: the hop back
1358
+ // from the clones is a write of `scrollLeft` by one full run, and a browser
1359
+ // that is itself scrolling or flinging the track (on the compositor) races
1360
+ // that write — it can paint the hopped-from offset for a frame, or blank
1361
+ // tiles it has not rastered. So a looping touch
1362
+ // drags exactly as the mouse does: `touch-action: pan-y pinch-zoom` (in
1363
+ // index.css) keeps vertical page scroll and pinch zoom with the browser and
1364
+ // hands the sideways gesture to pointer events, every scroll write is ours,
1365
+ // and the hop runs after our own write in the same task (see onPointerMove).
1366
+
1367
+ /** A pointer drag is under way. Not reactive: the class goes straight onto the
1368
+ * root, so starting a drag never re-renders the slides mid-gesture. */
1369
+ let dragging = false;
1370
+ const setDragging = (on: boolean) => {
1371
+ dragging = on;
1372
+ root.value?.classList.toggle('bb-carousel--dragging', on);
1373
+ };
1374
+ /** A finger or a pointer is on the track: autoplay and re-snaps wait. Owned
1375
+ * by the pointer handlers; the touch handlers only take it when a gesture
1376
+ * arrives with no pointer events at all (see onTouchStart). */
1377
+ const held = ref(false);
1378
+ let drag: {
1379
+ /** The one pointer this gesture follows (a second finger is ignored). */
1380
+ pointerId: number;
1381
+ pointerType: string;
1382
+ x: number;
1383
+ left: number;
1384
+ moved: boolean;
1385
+ /** Release speed, px/ms, positive while the scroll position falls. From
1386
+ * the samples' last ~120ms (see dragVelocity). */
1387
+ v: number;
1388
+ /** (time, scrollLeft) of every drag sample, the coalesced ones included:
1389
+ * at 120Hz a single pair of frames is mostly jitter. */
1390
+ samples: Array<{ t: number; left: number }>;
1391
+ /** The slide the gesture started from (a caught move's goal). */
1392
+ from: number;
1393
+ /** scrollLeft and time at the press. */
1394
+ start: number;
1395
+ t0: number;
1396
+ } | null = null;
1397
+ /** A native (non-loop) touch or pen press, by pointer id: the browser
1398
+ * scrolls; we only owe it `held` and the tap settle at its end. */
1399
+ let nativePress: number | null = null;
1400
+ /** `held` is owned by the touch handlers: a gesture with no pointer events,
1401
+ * or a native touch press the browser took over for its own pan (handed on
1402
+ * in releasePointer). The touch handlers are otherwise a running pointer
1403
+ * gesture's shadow and do nothing. One owner, never two. */
1404
+ let touchOwned = false;
1405
+ let swallowClick = false;
1406
+
1407
+ /** The samples' trailing speed, in drag.v's terms; 0 without a span to read. */
1408
+ const dragVelocity = (d: NonNullable<typeof drag>) => {
1409
+ const s = d.samples;
1410
+ if (s.length < 2) return 0;
1411
+ const last = s[s.length - 1];
1412
+ let first = s[0];
1413
+ for (let i = s.length - 1; i >= 0; i--) {
1414
+ if (last.t - s[i].t > 120) break;
1415
+ first = s[i];
1416
+ }
1417
+ const dt = last.t - first.t;
1418
+ return dt >= 16 ? (first.left - last.left) / dt : 0;
1419
+ };
1420
+
1421
+ /** As Swiper does: a mouse press on the track starts a drag, not the
1422
+ * browser's own image or link drag (WebKit cancels the pointer for it
1423
+ * mid-gesture) or a text selection. Form controls keep their press. The track
1424
+ * still takes the focus, so the arrow keys work after a click. */
1425
+ const NATIVE_PRESS =
1426
+ 'input, select, option, textarea, button, video, label, [contenteditable]';
1427
+ /** A press or wheel that belongs to this carousel, not to one nested in a
1428
+ * slide: its nearest track is ours. The event bubbles through both tracks,
1429
+ * and only the innermost may act on it (or one drag moves both rows). */
1430
+ const ownEvent = (event: Event) =>
1431
+ (event.target as Element | null)?.closest?.('.bb-carousel__track') ===
1432
+ track.value;
1433
+
1434
+ /** Only a sideways wheel (a trackpad swipe, Shift + wheel) is a move on the
1435
+ * carousel; a vertical one scrolls the page past it and must not catch, or
1436
+ * turn back, a running move. */
1437
+ const onWheel = (event: WheelEvent) => {
1438
+ if (!ownEvent(event)) return;
1439
+ if (Math.abs(event.deltaX) <= Math.abs(event.deltaY) && !event.shiftKey)
1440
+ return;
1441
+ // A wheel that catches a move settles on the quiet period, not on the
1442
+ // `scrollend` the catch's own scroll write fires at once: a move started
1443
+ // in that same task paints its first frame without its effect (a one-frame
1444
+ // flash at the destination), and the wheel's own delta gets to apply.
1445
+ if (moving()) {
1446
+ wheelCaught = true;
1447
+ clearTimeout(settleTimer);
1448
+ settleTimer = setTimeout(settle, 150);
1449
+ }
1450
+ userMove();
1451
+ };
1452
+
1453
+ /** Controls whose press and drag are their own. */
1454
+ const OWN_DRAG = 'input, select, option, textarea, video, [contenteditable]';
1455
+
1456
+ /** What the last press was, from its pointerdown (which comes first). */
1457
+ let pressType = 'mouse';
1458
+
1459
+ const onMouseDown = (event: MouseEvent) => {
1460
+ if (!ownEvent(event)) return;
1461
+ // A tap sends a compatibility mousedown after its touch: it is no mouse
1462
+ // press. Focusing the track from script there made Chrome count it as
1463
+ // keyboard focus (`:focus-visible`), which shows the arrows on a phone.
1464
+ if (pressType !== 'mouse') return;
1465
+ if (event.button !== 0 || snapCount() < 2) return;
1466
+ if ((event.target as Element).closest?.(NATIVE_PRESS)) return;
1467
+ event.preventDefault();
1468
+ // Focus from the mouse draws no ring (the browser's own mouse focus would
1469
+ // not either); a key press shows it again.
1470
+ if (track.value) {
1471
+ track.value.dataset.pointer = '';
1472
+ track.value.focus({ preventScroll: true });
1473
+ }
1474
+ };
1475
+
1476
+ const onPointerDown = (event: PointerEvent) => {
1477
+ if (!ownEvent(event)) return;
1478
+ // One gesture at a time: a second finger (a pinch starts) is not a drag.
1479
+ if (!event.isPrimary) return;
1480
+ pressType = event.pointerType;
1481
+ // A new primary press after a lost pointerup (a window blur, a capture
1482
+ // loss) would otherwise find the stale gesture forever: end it first —
1483
+ // no throw, to the nearest slide — and let this press start clean.
1484
+ if (drag || nativePress !== null) {
1485
+ touchOwned = false;
1486
+ releasePointer(undefined, true);
1487
+ }
1488
+ // Where the carousel was going (or resting), before the press clears it.
1489
+ // A new press: a click-swallow left by a drag released outside is stale.
1490
+ swallowClick = false;
1491
+ const from = target ?? index.value + lead.value;
1492
+ // A press on a text or media control is the control's (a range input drags
1493
+ // itself); a button or a label face still drags the carousel.
1494
+ if ((event.target as Element).closest?.(OWN_DRAG)) return;
1495
+ if (!track.value || snapCount() < 2) return;
1496
+ if (event.pointerType === 'mouse' && event.button !== 0) return;
1497
+ // A finger (or pen) stops a moving track where it stands, the platform's
1498
+ // convention. A mouse press never does (as Swiper): a click mid-move lets
1499
+ // it run on; only a real drag, past the 5px threshold, takes over.
1500
+ if (event.pointerType !== 'mouse') userMove();
1501
+ held.value = true;
1502
+ window.addEventListener('pointermove', onPointerMove);
1503
+ window.addEventListener('pointerup', onPointerUp);
1504
+ window.addEventListener('pointercancel', onPointerCancel);
1505
+ // Who drags: the mouse always; a finger or pen only when looping (without
1506
+ // loop the browser's own scrolling takes over from here, untouched).
1507
+ if (event.pointerType !== 'mouse' && !looping()) {
1508
+ nativePress = event.pointerId;
1509
+ return;
1510
+ }
1511
+ drag = {
1512
+ pointerId: event.pointerId,
1513
+ pointerType: event.pointerType,
1514
+ x: event.clientX,
1515
+ left: 0,
1516
+ moved: false,
1517
+ v: 0,
1518
+ samples: [],
1519
+ from,
1520
+ start: 0,
1521
+ t0: event.timeStamp,
1522
+ };
1523
+ };
1524
+
1525
+ const onPointerMove = (event: PointerEvent) => {
1526
+ if (!drag || !track.value || event.pointerId !== drag.pointerId) return;
1527
+ const dx = event.clientX - drag.x;
1528
+ if (!drag.moved && Math.abs(dx) < 5) return;
1529
+ if (!drag.moved) {
1530
+ // The drag starts here: it takes over a running move exactly where the
1531
+ // move shows the track, snapping off, from where the threshold was
1532
+ // crossed (no 5px catch-up jump). A finger already caught the move at
1533
+ // its press; catching again is a no-op, and the re-based origin is
1534
+ // the frozen position either way — no jump.
1535
+ drag.moved = true;
1536
+ drag.x = event.clientX;
1537
+ userMove();
1538
+ free = true;
1539
+ snapOff(true);
1540
+ drag.left = drag.start = track.value.scrollLeft;
1541
+ drag.samples = [{ t: event.timeStamp, left: drag.left }];
1542
+ setDragging(true);
1543
+ return;
1544
+ }
1545
+ // Every sample the browser coalesced into this event, for the release
1546
+ // speed; the position follows the finger's last word, exactly (1:1).
1547
+ const coalesced =
1548
+ typeof event.getCoalescedEvents === 'function'
1549
+ ? event.getCoalescedEvents()
1550
+ : [];
1551
+ for (const sample of coalesced.length ? coalesced : [event])
1552
+ drag.samples.push({
1553
+ t: sample.timeStamp,
1554
+ left: drag.left - (sample.clientX - drag.x),
1555
+ });
1556
+ const last = drag.samples[drag.samples.length - 1];
1557
+ drag.samples = drag.samples.filter((s) => last.t - s.t <= 250);
1558
+ drag.v = dragVelocity(drag);
1559
+ track.value.scrollLeft = last.left;
1560
+ // Loop: past either end, hop by a full run and keep dragging (the
1561
+ // gesture's start and its samples hop with it). Our own write, this same
1562
+ // task: no frame can paint the position in between, and no browser
1563
+ // scroll is running that could pull the offset back.
1564
+ const hop = wrap();
1565
+ if (hop) {
1566
+ drag.left += hop;
1567
+ drag.start += hop;
1568
+ drag.from += lastShift;
1569
+ drag.samples = drag.samples.map((s) => ({ t: s.t, left: s.left + hop }));
1570
+ }
1571
+ };
1572
+
1573
+ const onPointerUp = (event?: PointerEvent) => releasePointer(event, false);
1574
+ /** The browser took the gesture (it scrolls the page down, a pinch starts):
1575
+ * no throw, no swallowed click — just glide to the nearest slide. */
1576
+ const onPointerCancel = (event: PointerEvent) => releasePointer(event, true);
1577
+
1578
+ const releasePointer = (
1579
+ event: PointerEvent | undefined,
1580
+ cancelled: boolean
1581
+ ) => {
1582
+ // Another pointer's end is not this gesture's.
1583
+ if (
1584
+ event &&
1585
+ event.pointerId !== drag?.pointerId &&
1586
+ event.pointerId !== nativePress
1587
+ )
1588
+ return;
1589
+ // A native touch press the browser took over for its own pan: the cancel
1590
+ // is not the finger lifting (no pointerup follows it), so `held` is
1591
+ // handed to the touch handlers, whose touchend is the gesture's end.
1592
+ // Ending here instead dropped `held` under a still finger, and the
1593
+ // quiet-period settle glided the track under it (round-3 regression).
1594
+ // A pen has no touchend to hand to: its cancel stays an end.
1595
+ if (
1596
+ cancelled &&
1597
+ event &&
1598
+ event.pointerId === nativePress &&
1599
+ event.pointerType === 'touch'
1600
+ ) {
1601
+ window.removeEventListener('pointermove', onPointerMove);
1602
+ window.removeEventListener('pointerup', onPointerUp);
1603
+ window.removeEventListener('pointercancel', onPointerCancel);
1604
+ nativePress = null;
1605
+ touchOwned = true;
1606
+ return;
1607
+ }
1608
+ window.removeEventListener('pointermove', onPointerMove);
1609
+ window.removeEventListener('pointerup', onPointerUp);
1610
+ window.removeEventListener('pointercancel', onPointerCancel);
1611
+ held.value = false;
1612
+ const d = drag;
1613
+ drag = null;
1614
+ nativePress = null;
1615
+ if (!track.value) return;
1616
+ if (!d?.moved) {
1617
+ // A press without a drag: a running mouse move carries on. A finger
1618
+ // may have caught a move, and caught nothing scrolls, so no
1619
+ // `scrollend` comes: settle after a quiet moment (a native scroll in
1620
+ // between pushes it back), as the touchend path always did.
1621
+ if (event && event.pointerType !== 'mouse') {
1622
+ kick();
1623
+ clearTimeout(settleTimer);
1624
+ settleTimer = setTimeout(settle, 150);
1625
+ }
1626
+ return;
1627
+ }
1628
+ // The release is itself the last sample; a pointer that stopped before
1629
+ // letting go (or was taken from us) throws nothing.
1630
+ const lastMove = d.samples[d.samples.length - 1];
1631
+ if (event && !cancelled) {
1632
+ d.samples.push({
1633
+ t: event.timeStamp,
1634
+ left: d.left - (event.clientX - d.x),
1635
+ });
1636
+ d.v = dragVelocity(d);
1637
+ }
1638
+ if (cancelled || (event && lastMove && event.timeStamp - lastMove.t > 80))
1639
+ d.v = 0;
1640
+ swallowClick = !cancelled;
1641
+ setDragging(false);
1642
+ // Where to go is decided by the whole gesture, as Swiper does, never by
1643
+ // its last few pixels: a wobble back just before letting go must not throw
1644
+ // the carousel the other way. A quick swipe goes one slide on from the
1645
+ // slide it was released in, in its direction; a slower drag goes to the
1646
+ // nearest slide. Quick is the whole gesture under 300ms (a thumb flick
1647
+ // runs 60-150ms) or a release still travelling fast the gesture's way
1648
+ // (a long drag that ends in a flick); before the next slide's start the
1649
+ // two rules agree, so a slow drag let go there never overshoots.
1650
+ const at = track.value.scrollLeft;
1651
+ const moved = at - d.start;
1652
+ const sign = rtl() ? -1 : 1;
1653
+ const way = Math.sign(moved) * sign;
1654
+ let speed = -d.v * 1000;
1655
+ const fling = Math.abs(speed) > 400 && Math.sign(speed) === Math.sign(moved);
1656
+ const quick =
1657
+ !cancelled &&
1658
+ Math.abs(moved) > 5 &&
1659
+ (fling || (event?.timeStamp ?? d.t0) - d.t0 < 300);
1660
+ let goal = nearestChild();
1661
+ if (quick && way) {
1662
+ const off = (at - startOf(children()[goal])) * sign;
1663
+ // The page the release is in, along the swipe; then one page on.
1664
+ const before = way > 0 ? off < 0 : off > 0;
1665
+ goal = nextStart(before ? nextStart(goal, -way) : goal, way);
1666
+ }
1667
+ // The move keeps the drag's speed only when it already heads for the
1668
+ // goal; a counter-direction speed is dropped, not fought.
1669
+ if (Math.sign(speed) !== Math.sign(leftOf(goal) - at)) speed = 0;
1670
+ setCurrent(currentAt(realOf(goal)));
1671
+ head(goal, true, speed);
1672
+ };
1673
+
1674
+ /** The click that ends a drag is not a click on a slide. A click on a slide
1675
+ * in view makes it current, the view staying put. A click on a slide
1676
+ * peeking out of view (it is inert, so the click reaches the track) makes it
1677
+ * current too and brings in the page that holds it. Off with
1678
+ * `--peek-click: off`. */
1679
+ const onTrackClick = (event: MouseEvent) => {
1680
+ if (swallowClick) {
1681
+ swallowClick = false;
1682
+ event.preventDefault();
1683
+ event.stopPropagation();
1684
+ return;
1685
+ }
1686
+ // Mid-move the outgoing slide is already inert, so a click on it lands on
1687
+ // the track: never a peek click that turns the move back (Swiper ignores
1688
+ // clicks mid-move too).
1689
+ if (moving()) return;
1690
+ if (!root.value || !track.value) return;
1691
+ /** A click on slide (child) `c` in view: it becomes current. A picker
1692
+ * strip follows the pick, a centred row centres it; a page stays put. */
1693
+ const pick = (c: number) => {
1694
+ if (props.picker || centred.value) return select(realOf(c), true);
1695
+ if (realOf(c) === current.value) return;
1696
+ setCurrent(realOf(c));
1697
+ announce(realOf(c));
1698
+ };
1699
+ if (event.target !== track.value) {
1700
+ // Our own slide, past those of a carousel nested in it.
1701
+ let slide = (event.target as Element).closest?.('.bb-carousel__slide');
1702
+ while (slide && slide.parentElement !== track.value)
1703
+ slide = slide.parentElement?.closest('.bb-carousel__slide') ?? null;
1704
+ const c = slide ? children().indexOf(slide as HTMLElement) : -1;
1705
+ if (c >= 0 && !slide!.hasAttribute('inert')) pick(c);
1706
+ return;
1707
+ }
1708
+ const els = children();
1709
+ const c = els.findIndex((el) => {
1710
+ const r = el.getBoundingClientRect();
1711
+ return event.clientX >= r.left && event.clientX <= r.right;
1712
+ });
1713
+ if (c < 0 || !els[c].hasAttribute('inert')) return;
1714
+ // A clone fully in view (the short last page of a loop shows the first
1715
+ // slides again) is inert like every clone, but no peek: a click picks it.
1716
+ // (The root's box: with bleed the track runs on past the column.)
1717
+ const box = root.value.getBoundingClientRect();
1718
+ const r = els[c].getBoundingClientRect();
1719
+ if (r.left >= box.left - 1 && r.right <= box.right + 1) return pick(c);
1720
+ if (
1721
+ getComputedStyle(root.value).getPropertyValue('--peek-click').trim() ===
1722
+ 'off'
1723
+ )
1724
+ return;
1725
+ if (props.picker) return select(realOf(c), true);
1726
+ // The page that holds it (centred: the slide itself, to the middle).
1727
+ let goal = c;
1728
+ while (goal > 0 && !isStartChild(goal)) goal--;
1729
+ if (!lead.value) goal = viewFor(c);
1730
+ setCurrent(realOf(c));
1731
+ head(goal, true);
1732
+ };
1733
+
1734
+ const onTouchStart = (event: TouchEvent) => {
1735
+ if (!ownEvent(event)) return;
1736
+ if (drag || nativePress !== null || touchOwned) return;
1737
+ if (!event.touches.length) return;
1738
+ touchOwned = true;
1739
+ held.value = true;
1740
+ userMove();
1741
+ };
1742
+ const onTouchEnd = (event: TouchEvent) => {
1743
+ if (!touchOwned || event.touches.length) return;
1744
+ touchOwned = false;
1745
+ held.value = false;
1746
+ kick();
1747
+ // A tap that caught a move scrolls nothing, so no `scrollend` comes:
1748
+ // settle after a quiet moment (a scroll in between pushes it back).
1749
+ clearTimeout(settleTimer);
1750
+ settleTimer = setTimeout(settle, 150);
1751
+ };
1752
+
1753
+ // ---- Keyboard ----------------------------------------------------------------
1754
+
1755
+ const typing = (el: EventTarget | null) =>
1756
+ el instanceof HTMLElement &&
1757
+ (el.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(el.tagName));
1758
+
1759
+ /** Content whose own keys the arrows are: they stay with it. */
1760
+ const OWN_KEYS =
1761
+ 'audio, video, [role="slider"], [role="spinbutton"], [role="tablist"], [role="tab"], [role="menu"], [role="menubar"], [role="menuitem"], [role="listbox"], [role="option"], [role="radiogroup"], [role="radio"], [role="grid"], [role="tree"], [role="combobox"], [role="toolbar"]';
1762
+ const FOCUSABLE =
1763
+ 'a[href], button, input, select, textarea, [tabindex]:not([tabindex="-1"])';
1764
+
1765
+ const onKeydown = (event: KeyboardEvent) => {
1766
+ delete track.value?.dataset.pointer;
1767
+ if (typing(event.target) || event.altKey || event.ctrlKey || event.metaKey)
1768
+ return;
1769
+ const el = event.target as Element;
1770
+ // Focus on something inside a slide (a thumbnail's button, a card's
1771
+ // link): the arrows move the carousel too, and the focus follows to the
1772
+ // current slide (else the browser scrolled the track a step itself, and
1773
+ // the focused slide went inert under the focus). Not for content that
1774
+ // uses the arrows itself, nor a carousel nested in the slide (its own
1775
+ // handler had them).
1776
+ const inSlide = !!el.closest?.('.bb-carousel__slide');
1777
+ if (
1778
+ inSlide &&
1779
+ (event.defaultPrevented ||
1780
+ el.closest('.bb-carousel') !== root.value ||
1781
+ el.closest(OWN_KEYS))
1782
+ )
1783
+ return;
1784
+ const forward = rtl() ? 'ArrowLeft' : 'ArrowRight';
1785
+ const back = rtl() ? 'ArrowRight' : 'ArrowLeft';
1786
+ const last = props.picker ? count.value - 1 : snapCount() - 1;
1787
+ if (event.key === forward) step(1);
1788
+ else if (event.key === back) step(-1);
1789
+ else if (event.key === 'Home')
1790
+ props.picker ? select(0, true) : goPage(0, true);
1791
+ else if (event.key === 'End')
1792
+ props.picker ? select(last, true) : goPage(last, true);
1793
+ else return;
1794
+ event.preventDefault();
1795
+ if (inSlide)
1796
+ void nextTick(() =>
1797
+ realEl(current.value)
1798
+ ?.querySelector<HTMLElement>(FOCUSABLE)
1799
+ ?.focus({ preventScroll: true })
1800
+ );
1801
+ };
1802
+
1803
+ // ---- Autoplay ----------------------------------------------------------------
1804
+
1805
+ const autoplayMs = computed(() =>
1806
+ props.autoplay === true ? 5000 : Number(props.autoplay) || 0
1807
+ );
1808
+ const hovered = ref(false);
1809
+ const focused = ref(false);
1810
+ /** The reader stopped it (the button, or keyboard focus inside: APG). */
1811
+ const userPaused = ref(false);
1812
+ /** The reader pressed Play: hover and focus no longer hold it. */
1813
+ const playPressed = ref(false);
1814
+ const pageHidden = ref(false);
1815
+ const reduced = ref(false);
1816
+ const offscreen = ref(false);
1817
+
1818
+ const onFocusIn = (event: FocusEvent) => {
1819
+ focused.value = true;
1820
+ // Keyboard focus entering stops the rotation until the reader restarts
1821
+ // it (APG); a mouse click on a slide only holds it while focus stays.
1822
+ const el = event.target as Element;
1823
+ if (
1824
+ autoplayMs.value > 0 &&
1825
+ !playPressed.value &&
1826
+ !el.classList.contains('bb-carousel__pause') &&
1827
+ el.matches?.(':focus-visible')
1828
+ )
1829
+ userPaused.value = true;
1830
+ };
1831
+ const onFocusOut = (event: FocusEvent) => {
1832
+ if (!root.value?.contains(event.relatedTarget as Node | null)) {
1833
+ focused.value = false;
1834
+ if (!hovered.value) playPressed.value = false;
1835
+ }
1836
+ };
1837
+ const onMouseLeave = () => {
1838
+ hovered.value = false;
1839
+ if (!focused.value) playPressed.value = false;
1840
+ };
1841
+ const togglePlay = () => {
1842
+ userPaused.value = !userPaused.value;
1843
+ playPressed.value = !userPaused.value;
1844
+ };
1845
+
1846
+ /** No rotation can ever run: no button either. */
1847
+ const showPause = () =>
1848
+ mounted.value && autoplayMs.value > 0 && !reduced.value && snapCount() > 1;
1849
+
1850
+ const running = computed(
1851
+ () =>
1852
+ showPause() &&
1853
+ !userPaused.value &&
1854
+ !pageHidden.value &&
1855
+ !offscreen.value &&
1856
+ !held.value &&
1857
+ (playPressed.value || (!hovered.value && !focused.value))
1858
+ );
1859
+
1860
+ let timer: ReturnType<typeof setInterval> | undefined;
1861
+ const startTimer = () => {
1862
+ clearInterval(timer);
1863
+ if (!running.value) return;
1864
+ // Autoplay always wraps (through the clones with loop): a rotation that
1865
+ // stops at the end is a stall.
1866
+ timer = setInterval(() => {
1867
+ if (props.picker)
1868
+ select(current.value >= count.value - 1 ? 0 : current.value + 1);
1869
+ else if (looping()) step(1, false);
1870
+ else {
1871
+ const p = curPage();
1872
+ goPage(p >= snapCount() - 1 ? 0 : p + 1);
1873
+ }
1874
+ }, autoplayMs.value);
1875
+ };
1876
+ /** A reader's move restarts the countdown: no advance right after it. */
1877
+ const kick = () => {
1878
+ if (running.value) startTimer();
1879
+ };
1880
+ watch([running, autoplayMs], startTimer, { flush: 'post' });
1881
+
1882
+ // ---- Bleed: spill past the root to the edges of what clips it -------------
1883
+
1884
+ /* `--bleed` (or `--bleed-start` / `--bleed-end`) is a length, which CSS
1885
+ applies alone, or `auto`: measured here and handed to the CSS as
1886
+ `--_bleed-start` / `--_bleed-end`, only for the sides set to `auto`. */
1887
+ const autoStart = ref(false);
1888
+ const autoEnd = ref(false);
1889
+ const bleeding = computed(
1890
+ () => mounted.value && (bleedStart.value > 0 || bleedEnd.value > 0)
1891
+ );
1892
+ /** The `perView` / `bleed` props, as the locals they stand for; nothing at
1893
+ * all when they are left out, so a consumer's own locals apply untouched. */
1894
+ const localStyle = computed(() => {
1895
+ // Keys only for the props given: an `undefined` key would make Vue clear
1896
+ // an inline local someone else set, on every render.
1897
+ const style: Record<string, string> = {};
1898
+ if (props.perView !== undefined) style['--per-view'] = String(props.perView);
1899
+ if (props.bleed !== undefined)
1900
+ style['--bleed'] = props.bleed ? 'auto' : '0px';
1901
+ if (props.align !== undefined) style['--align'] = props.align;
1902
+ return style;
1903
+ });
1904
+ watch(
1905
+ () => [props.perView, props.bleed, props.align],
1906
+ () => void nextTick(remeasure)
1907
+ );
1908
+
1909
+ const bleedStyle = computed(() =>
1910
+ mounted.value
1911
+ ? {
1912
+ '--_cp': centred.value ? `${centrePad.value}px` : undefined,
1913
+ '--_bleed-start': autoStart.value ? `${bleedStart.value}px` : undefined,
1914
+ '--_bleed-end': autoEnd.value ? `${bleedEnd.value}px` : undefined,
1915
+ }
1916
+ : undefined
1917
+ );
1918
+
1919
+ /** The nearest ancestor that clips sideways, or the page. */
1920
+ const clipBox = (): { left: number; right: number } => {
1921
+ let el = root.value?.parentElement ?? null;
1922
+ while (el && el !== document.body && el !== document.documentElement) {
1923
+ const x = getComputedStyle(el).overflowX;
1924
+ if (x !== 'visible') {
1925
+ const r = el.getBoundingClientRect();
1926
+ return {
1927
+ left: r.left + el.clientLeft,
1928
+ right: r.left + el.clientLeft + el.clientWidth,
1929
+ };
1930
+ }
1931
+ el = el.parentElement;
1932
+ }
1933
+ // The page, without its scrollbar (100vw would include it).
1934
+ return { left: 0, right: document.documentElement.clientWidth };
1935
+ };
1936
+
1937
+ const measureBleed = () => {
1938
+ if (!root.value || !track.value) return;
1939
+ const css = getComputedStyle(root.value);
1940
+ autoStart.value = css.getPropertyValue('--bleed-start').trim() === 'auto';
1941
+ autoEnd.value = css.getPropertyValue('--bleed-end').trim() === 'auto';
1942
+ let start = 0;
1943
+ let end = 0;
1944
+ if (autoStart.value || autoEnd.value) {
1945
+ const r = root.value.getBoundingClientRect();
1946
+ if (!r.width) return;
1947
+ const box = clipBox();
1948
+ const left = Math.max(0, Math.floor(r.left - box.left));
1949
+ const right = Math.max(0, Math.floor(box.right - r.right));
1950
+ start = rtl() ? right : left;
1951
+ end = rtl() ? left : right;
1952
+ }
1953
+ // The sides given as lengths: what the CSS applied (the track's padding).
1954
+ const t = getComputedStyle(track.value);
1955
+ if (!autoStart.value) start = parseFloat(t.paddingInlineStart) || 0;
1956
+ if (!autoEnd.value) end = parseFloat(t.paddingInlineEnd) || 0;
1957
+ bleedStart.value = start;
1958
+ bleedEnd.value = end;
1959
+ };
1960
+
1961
+ // ---- Lifecycle -------------------------------------------------------------
1962
+
1963
+ let resize: ResizeObserver | undefined;
1964
+ let visibility: IntersectionObserver | undefined;
1965
+ let motion: MediaQueryList | undefined;
1966
+ const onMotion = () => (reduced.value = !!motion?.matches);
1967
+ const onVisibility = () => (pageHidden.value = document.hidden);
1968
+ const onWindowResize = () => remeasure();
1969
+
1970
+ onMounted(() => {
1971
+ mounted.value = true;
1972
+ shownChild.value = index.value + lead.value;
1973
+ measure();
1974
+ void nextTick(() => {
1975
+ measure();
1976
+ lastSignature = '';
1977
+ remeasure();
1978
+ });
1979
+ resize = new ResizeObserver(() => remeasure());
1980
+ // The track and the first slide (a `--per-view` change at a breakpoint
1981
+ // resizes the slides even when the track keeps its width); with bleed, the
1982
+ // root and the page too (the column can move without resizing).
1983
+ if (track.value) resize.observe(track.value);
1984
+ if (realEl(0)) resize.observe(realEl(0));
1985
+ // The root and the page too: the column can move without resizing (a
1986
+ // sidebar opening), and `--bleed: auto` follows it.
1987
+ resize.observe(root.value!);
1988
+ resize.observe(document.documentElement);
1989
+ window.addEventListener('resize', onWindowResize);
1990
+ visibility = new IntersectionObserver(([e]) => {
1991
+ offscreen.value = !e.isIntersecting;
1992
+ if (e.isIntersecting) remeasure();
1993
+ });
1994
+ visibility.observe(root.value!);
1995
+ motion = window.matchMedia?.('(prefers-reduced-motion: reduce)');
1996
+ onMotion();
1997
+ motion?.addEventListener('change', onMotion);
1998
+ document.addEventListener('visibilitychange', onVisibility);
1999
+ });
2000
+
2001
+ // Slides added or removed (or clones): the snap positions move with them.
2002
+ let rendered = -1;
2003
+ onUpdated(() => {
2004
+ joinMove();
2005
+ const n = children().length;
2006
+ if (n !== rendered) {
2007
+ rendered = n;
2008
+ remeasure();
2009
+ if (realEl(0)) resize?.observe(realEl(0));
2010
+ }
2011
+ });
2012
+
2013
+ watch(
2014
+ () => [props.loop, props.picker],
2015
+ () => {
2016
+ lastSignature = '';
2017
+ void nextTick(remeasure);
2018
+ }
2019
+ );
2020
+
2021
+ onBeforeUnmount(() => {
2022
+ clearInterval(timer);
2023
+ clearTimeout(settleTimer);
2024
+ cancelAnimationFrame(frame);
2025
+ stopMove();
2026
+ resize?.disconnect();
2027
+ visibility?.disconnect();
2028
+ motion?.removeEventListener('change', onMotion);
2029
+ document.removeEventListener('visibilitychange', onVisibility);
2030
+ window.removeEventListener('resize', onWindowResize);
2031
+ onPointerUp();
2032
+ });
2033
+ </script>
2034
+
2035
+ <style lang="postcss">
2036
+ @import './index.css';
2037
+ </style>
2038
+ ```
2039
+
2040
+ ## Types
2041
+
2042
+ ```ts
2043
+ import type { PtCompoundProps, PtValue } from '@/types/passthrough';
2044
+ import type { BbCarouselPtKeys } from './ptKeys.generated';
2045
+
2046
+ /**
2047
+ * Passthrough parts of `BbCarousel`.
2048
+ *
2049
+ * @part root - The carousel region (`aria-roledescription="carousel"`). Its
2050
+ * locals size the slides: `--per-view` (slides in view, default `1`) and
2051
+ * `--gap` (between slides, default `16px`). Set them per breakpoint with
2052
+ * utilities (`class="md:[--per-view:2]"`). `--bleed` (`auto` or a length;
2053
+ * per side `--bleed-start` / `--bleed-end`) lets the slides run past the
2054
+ * root to the page edge while they still snap to the root's edge.
2055
+ * `--speed` (default `300ms`) is how long a move takes. The root also
2056
+ * carries what looks like the strip's own styling: a background behind
2057
+ * the slides, a border or a shadow around them, the corners (`--r`).
2058
+ * @part slide - One slide (`aria-roledescription="slide"`, "3 of 8").
2059
+ * @part image - The image an image-URL entry of `items`, or an entry with a
2060
+ * `src` or a `srcset`, renders without a `slide` slot. Its crop is the
2061
+ * root's `--ratio` local (default `16 / 9`), or the root's height when it
2062
+ * has one.
2063
+ *
2064
+ * The track (the scroller between the root and the slides) is deliberately
2065
+ * NOT a part: its gap, overflow, snapping and padding are the carousel's
2066
+ * geometry (the slide widths, the snap points and the bleed are computed
2067
+ * from the same values), so a class there breaks the carousel, and the root
2068
+ * already covers every look a consumer needs. Weigh any change that would
2069
+ * expose it, or add to what it does, against that.
2070
+ * @part overlay - The layer the `overlay` slot renders on top of each
2071
+ * slide: the slide's size, empty by default, letting taps through where
2072
+ * it has no content.
2073
+ * @part prev - The previous-slide button.
2074
+ * @part next - The next-slide button.
2075
+ * @part dots - The row of dot buttons.
2076
+ * @part dot - One dot (one per page).
2077
+ * @part pause - The autoplay pause / play button (only with `autoplay`), first
2078
+ * in the dots' row.
2079
+ */
2080
+ export type BbCarouselPtPart =
2081
+ | 'root'
2082
+ | 'slide'
2083
+ | 'image'
2084
+ | 'overlay'
2085
+ | 'prev'
2086
+ | 'next'
2087
+ | 'dots'
2088
+ | 'dot'
2089
+ | 'pause';
2090
+
2091
+ /**
2092
+ * Passthrough states of `BbCarousel`.
2093
+ *
2094
+ * @state active - Per node, on `slide` / `dot`: a slide in view (a
2095
+ * fractional peek and, with `--bleed`, the slides outside the root are
2096
+ * not), live while a swipe runs; the current page's dot.
2097
+ * @state current - Per node, on `slide`: the current slide (the `v-model`).
2098
+ * @state disabled - Per node, on `prev` / `next`: the button at an end
2099
+ * without `loop`.
2100
+ */
2101
+ export type BbCarouselPtState = 'active' | 'current' | 'disabled';
2102
+
2103
+ /** The runtime lists the resolver is wired with. */
2104
+ export const BB_CAROUSEL_PT = {
2105
+ parts: [
2106
+ 'root',
2107
+ 'slide',
2108
+ 'image',
2109
+ 'overlay',
2110
+ 'prev',
2111
+ 'next',
2112
+ 'dots',
2113
+ 'dot',
2114
+ 'pause',
2115
+ ],
2116
+ states: ['current', 'disabled', 'active'],
2117
+ /** On every part: none; every state is one node's. */
2118
+ wide: [],
2119
+ /** Per node: what one slide, dot or arrow knows. */
2120
+ node: {
2121
+ slide: ['active', 'current'],
2122
+ dot: ['active'],
2123
+ prev: ['disabled'],
2124
+ next: ['disabled'],
2125
+ },
2126
+ } as const satisfies {
2127
+ parts: readonly BbCarouselPtPart[];
2128
+ states: readonly BbCarouselPtState[];
2129
+ wide: readonly BbCarouselPtState[];
2130
+ node: Partial<Record<BbCarouselPtPart, readonly BbCarouselPtState[]>>;
2131
+ };
2132
+
2133
+ /**
2134
+ * Every `part` / `part:state` key of `BbCarousel` — only the pairs that land.
2135
+ * `PtKeysOf<typeof BB_CAROUSEL_PT>` is the same union; a type test pins them.
2136
+ */
2137
+ export type BbCarouselPtKey =
2138
+ | BbCarouselPtPart
2139
+ | `${'slide' | 'dot'}:active`
2140
+ | 'slide:current'
2141
+ | `${'prev' | 'next'}:disabled`;
2142
+
2143
+ /**
2144
+ * BbCarousel's `pt:*` attributes: the documented keys, and the patterns
2145
+ * Vue's SFC resolver skips (compound keys; the vue-ignore marker). This alias
2146
+ * keeps the marker on a member right after its `=`: the declaration emit
2147
+ * drops it at the start of a line or ahead of a whole type.
2148
+ */
2149
+ type BbCarouselPtProps = /* @vue-ignore */ PtCompoundProps<
2150
+ typeof BB_CAROUSEL_PT
2151
+ > &
2152
+ BbCarouselPtKeys;
2153
+
2154
+ /**
2155
+ * An image slide: an entry of `items` the carousel renders itself (as a
2156
+ * cover-cropped `img`) when there is no `slide` slot. A bare URL string does
2157
+ * the same with an empty `alt`.
2158
+ */
2159
+ export type BbCarouselImage = {
2160
+ /** The image URL. Optional with `srcset`: the browser picks from it. */
2161
+ src?: string;
2162
+ /** The text alternative. Left out, it is empty: a decorative image. */
2163
+ alt?: string;
2164
+ /** Candidate files by width (`"a.jpg 640w, b.jpg 1280w"`), as on an `img`. */
2165
+ srcset?: string;
2166
+ /** The slot width per breakpoint for `srcset` (`"(min-width: 960px) 960px, 100vw"`). */
2167
+ sizes?: string;
2168
+ } & ({ src: string } | { srcset: string });
2169
+
2170
+ export type BbCarouselProps<T = number> = BbCarouselPtProps & {
2171
+ /**
2172
+ * Passthrough, object form: the same keys as the `pt:*` attributes
2173
+ * without the prefix.
2174
+ */
2175
+ // eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style
2176
+ pt?: { [K in BbCarouselPtKey]?: PtValue };
2177
+ /**
2178
+ * The current slide, 0-based, never clamped to a scroll position: the
2179
+ * view shows the page that holds it. Out of range, it is brought back and
2180
+ * written back.
2181
+ *
2182
+ * @defaultValue `0`
2183
+ */
2184
+ modelValue?: number;
2185
+ /**
2186
+ * The slides as data, rendered through the `slide` slot (`item` is the
2187
+ * entry; with a number, that many slides and `item` is the index).
2188
+ * Without the slot, an image URL or a `{ src, alt }` entry renders as a
2189
+ * cover image. Without `items`, each default-slot child is a slide.
2190
+ *
2191
+ * @defaultValue `undefined`
2192
+ */
2193
+ items?: readonly T[] | number;
2194
+ /**
2195
+ * Slides in view; a fraction shows a peek of the next (`1.2`). Sets the
2196
+ * `--per-view` local. Leave it out to set the local yourself, for
2197
+ * instance per breakpoint (`class="[--per-view:1.2] md:[--per-view:3]"`);
2198
+ * never both (`bitboss-ui/carousel-prop-or-local`).
2199
+ *
2200
+ * @defaultValue `undefined` (the local's own default: 1)
2201
+ */
2202
+ perView?: number;
2203
+ /**
2204
+ * Lets the slides run past the carousel to the page edge, while they
2205
+ * still snap to and size from the carousel (`--bleed: auto`). Leave it
2206
+ * out to set the `--bleed` locals yourself (a length, one side, per
2207
+ * breakpoint); never both (`bitboss-ui/carousel-prop-or-local`).
2208
+ *
2209
+ * @defaultValue `undefined` (no bleed)
2210
+ */
2211
+ bleed?: boolean;
2212
+ /**
2213
+ * Where the current slide sits: `start` (the column's start edge) or
2214
+ * `center` (the middle, neighbours peeking on both sides). Sets the
2215
+ * `--align` local; leave it out to set the local yourself, never both
2216
+ * (`bitboss-ui/carousel-prop-or-local`).
2217
+ *
2218
+ * @defaultValue `undefined` (the local's own default: `start`)
2219
+ */
2220
+ align?: 'start' | 'center';
2221
+ /**
2222
+ * A strip that picks the current slide, typically thumbnails under a big
2223
+ * photo on the same `v-model` (also dates, colour swatches): it steps one slide at a time (arrows,
2224
+ * keys), follows the current one, keeping it in the middle slot with the
2225
+ * ends clamped, and a swipe only browses.
2226
+ *
2227
+ * @defaultValue `false`
2228
+ */
2229
+ picker?: boolean;
2230
+ /**
2231
+ * An endless run: buttons, keys, autoplay, a swipe and a mouse drag all
2232
+ * carry on past the last slide into the first (and back), with no rewind.
2233
+ *
2234
+ * @defaultValue `false`
2235
+ */
2236
+ loop?: boolean;
2237
+ /**
2238
+ * Advance on a timer, in ms (`true` = 5000). Pauses while hovered, while
2239
+ * focus is inside and with the pause button; never runs under
2240
+ * `prefers-reduced-motion`.
2241
+ *
2242
+ * @defaultValue `false`
2243
+ */
2244
+ autoplay?: boolean | number;
2245
+ /**
2246
+ * The carousel's accessible name. Default: the locale's "Carousel".
2247
+ *
2248
+ * @defaultValue `undefined`
2249
+ */
2250
+ label?: string;
2251
+ };
2252
+
2253
+ export type BbCarouselEvents = {
2254
+ /** The current slide changed (a click on a slide, a page turned by a
2255
+ * swipe, a button, a key, a dot, autoplay). */
2256
+ 'update:modelValue': [index: number];
2257
+ };
2258
+
2259
+ /**
2260
+ * What the slide slots get: `slide` as `BbCarouselSlotProps<T>`; `overlay`,
2261
+ * `slide:header` and `slide:footer` as `BbCarouselSlotProps<T | undefined>`
2262
+ * (`item` is undefined over a default-slot child).
2263
+ */
2264
+ export type BbCarouselSlotProps<T = number> = {
2265
+ /** The entry of `items` (the index when `items` is a number). */
2266
+ item: T;
2267
+ /** Its index. */
2268
+ index: number;
2269
+ /** Whether it is in view, live while a swipe runs. */
2270
+ active: boolean;
2271
+ /** Whether it is the current slide (the `v-model`). */
2272
+ current: boolean;
2273
+ };
2274
+
2275
+ export type BbCarouselSlots<T = number> = {
2276
+ /** The slides: one per child. */
2277
+ default?: () => unknown;
2278
+ /** One slide's content, from `items` (replaces the built-in image). */
2279
+ slide?: (props: BbCarouselSlotProps<T>) => unknown;
2280
+ /** A layer on top of each slide (any kind), moving with it: captions,
2281
+ * badges, glyphs, buttons. */
2282
+ overlay?: (props: BbCarouselSlotProps<T | undefined>) => unknown;
2283
+ /** Above each slide's content, inside the slide (any kind of slide; the
2284
+ * built-in image keeps its lazy loading, sizes and crop): a kicker, a
2285
+ * title. */
2286
+ 'slide:header'?: (props: BbCarouselSlotProps<T | undefined>) => unknown;
2287
+ /** Below each slide's content, inside the slide (any kind of slide): a
2288
+ * caption, a price, a link. */
2289
+ 'slide:footer'?: (props: BbCarouselSlotProps<T | undefined>) => unknown;
2290
+ };
2291
+ ```
2292
+
2293
+ ## Styles
2294
+
2295
+ ```css
2296
+ /* BbCarousel: a native scroll-snap track. The browser owns the swipe, the
2297
+ momentum and the snap; the component only reads where it came to rest.
2298
+ With `loop` a touch drags through pointer events instead (see the
2299
+ `.bb-carousel--loop` rule): the hop back from the clones must never race
2300
+ a scroll the browser is running.
2301
+
2302
+ Locals (on the root, per breakpoint with utilities):
2303
+ - `--per-view`: slides in view (default 1; 1.2 shows a peek of the next);
2304
+ - `--gap`: between slides (default 16px);
2305
+ - `--r`: the slides' corner radius (default the system radius);
2306
+ - `--ratio`: the crop of a built-in image slide (default 16 / 9);
2307
+ - `--dot` / `--dot-active`: the dot colours, light: the dots sit on the
2308
+ slides, on their own dark pill (see the dots block);
2309
+ - `--bleed` (per side `--bleed-start` / `--bleed-end`): how far the
2310
+ slides run past the root, `auto` (measured: to the nearest ancestor
2311
+ that clips, else the page edge) or a length; they still snap to the
2312
+ root's edge and are sized from its width (default 0);
2313
+ - `--peek-click`: `off` stops a click on a slide peeking out of view
2314
+ from bringing it in;
2315
+ - `--speed`: how long a move takes (default 300ms, Swiper's; `0ms`
2316
+ jumps). */
2317
+ .bb-carousel {
2318
+ --per-view: 1;
2319
+ --gap: 16px;
2320
+ --r: var(--bb-radius);
2321
+ --ratio: 16 / 9;
2322
+ --dot: rgb(255 255 255 / 0.8);
2323
+ --dot-active: rgb(255 255 255);
2324
+ --speed: 300ms;
2325
+ --align: start;
2326
+ /* Room above and below the slides inside the track (see the track). */
2327
+ --py: 0px;
2328
+ --bleed: 0px;
2329
+ --bleed-start: var(--bleed);
2330
+ --bleed-end: var(--bleed);
2331
+ /* The resolved bleed per side (the measured `auto`, or the length): read
2332
+ by the track and, when bled, by the arrows. */
2333
+ --_bs: var(--_bleed-start, var(--bleed-start));
2334
+ --_be: var(--_bleed-end, var(--bleed-end));
2335
+ /* The controls scale with ONE SLIDE: a wide hero gets big arrows, a row
2336
+ of narrow cards small ones, at the same carousel width. A percentage,
2337
+ not `cqi`: they are absolutely positioned, so `100%` is the root's
2338
+ width. A size container (`container-type: inline-size`) would collapse
2339
+ a carousel that takes its width from its content (a centred flex
2340
+ column, Storybook's own canvas) to 0. Read where it is used, so only
2341
+ in a `width` (never a `height`: there `%` is the root's height). */
2342
+ --arrow: clamp(
2343
+ 28px,
2344
+ (100% - (var(--per-view) - 1) * var(--gap)) / var(--per-view) * 0.09,
2345
+ 44px
2346
+ );
2347
+ --inset: 12px;
2348
+ /* No overflow clip here, ever: the dots (and arrows) are positioned
2349
+ against the root, and moving them outside it through pt (`pt:dots=
2350
+ "top-full mt-2"`) must not cut them off. The track clips the slides. */
2351
+ display: grid;
2352
+ /* The arrows', pause's and dots' z-index stays inside the carousel. */
2353
+ isolation: isolate;
2354
+ min-width: 0;
2355
+ position: relative;
2356
+ }
2357
+
2358
+ /* The track: the carousel's geometry, NOT a pt part.
2359
+ Its gap, overflow, snap and padding are read back by the slide widths
2360
+ (`--gap`), the snap points, the bleed and the JS measurements, so any
2361
+ change here moves all of them: weigh it against every mode (per-view,
2362
+ fractional, bleed, loop, RTL, touch drag) before making it, and never
2363
+ expose it to consumer classes. Its look lives on the root. */
2364
+ .bb-carousel__track {
2365
+ /* Rounded too: a slide half out of view is cut by the track's edge, and
2366
+ a square edge there would square its corners mid-swipe. */
2367
+ --_tr: var(--r);
2368
+
2369
+ border-radius: var(--_tr);
2370
+ display: flex;
2371
+ gap: var(--gap);
2372
+ /* Bleed: the track spills past the root by the bleed on each side and
2373
+ pads it back, so the slides are still sized from the root's width (a
2374
+ flex-basis percentage reads the content box) and snap to its edge.
2375
+ `auto` is measured (`--_bleed-*`, set inline); unmeasured, `auto` is
2376
+ invalid here and every value falls back to 0 (the server render). */
2377
+ /* `--py`: the track is a scroller, so it clips both axes; a ribbon, a
2378
+ shadow, a hover lift or a focus outline poking out of a slide is cut.
2379
+ Room inside the track, given back by a negative margin, lets them show
2380
+ while nothing on the page moves. */
2381
+ margin-block: calc(-1 * var(--py));
2382
+ margin-inline: calc(-1 * var(--_bs)) calc(-1 * var(--_be));
2383
+ overflow-x: auto;
2384
+ /* Sideways only: a slide taller than a fixed-height carousel is cut, never
2385
+ scrolled up and down inside the track (`overflow-x: auto` alone would
2386
+ make the other axis scroll too). */
2387
+ overflow-y: hidden;
2388
+ /* A sideways overscroll is not the browser's back gesture. */
2389
+ overscroll-behavior-x: contain;
2390
+ padding-block: var(--py);
2391
+ padding-inline: var(--_bs) var(--_be);
2392
+ /* `offsetLeft` of a slide is against the track. */
2393
+ position: relative;
2394
+ /* Plus, centred (`--align: center`), the measured `--_cp`: half the room
2395
+ beside a slide in the column, so a snap point puts it in the middle. */
2396
+ scroll-padding-inline: calc(var(--_bs) + var(--_cp, 0px))
2397
+ calc(var(--_be) + var(--_cp, 0px));
2398
+ scroll-snap-type: x mandatory;
2399
+ scrollbar-width: none;
2400
+
2401
+ &::-webkit-scrollbar {
2402
+ display: none;
2403
+ }
2404
+
2405
+ &:focus-visible {
2406
+ outline: var(--bb-ring-size) solid var(--bb-ring);
2407
+ outline-offset: 2px;
2408
+ }
2409
+
2410
+ /* Focused by a mouse click on a slide (so the arrow keys work): no ring,
2411
+ as the browser's own mouse focus draws none. A key press clears it. */
2412
+ &[data-pointer]:focus-visible {
2413
+ outline: none;
2414
+ }
2415
+ }
2416
+
2417
+ /* With `--py`, the track's own rounding would round the room's corners, not
2418
+ the slides': a mask rounds the slide band instead, so a slide half out of
2419
+ view keeps round corners mid-swipe. Only when there is room (the class is
2420
+ set when `--py` is above 0). */
2421
+ .bb-carousel--py .bb-carousel__track {
2422
+ --m: linear-gradient(#000 0 0);
2423
+ --c: radial-gradient(
2424
+ closest-side circle,
2425
+ #000 calc(100% - 0.5px),
2426
+ #0000 100%
2427
+ );
2428
+ --d: calc(2 * var(--_tr));
2429
+
2430
+ mask:
2431
+ var(--m) top / 100% var(--py),
2432
+ var(--m) bottom / 100% var(--py),
2433
+ var(--m) center / 100% calc(100% - 2 * var(--py) - var(--d)),
2434
+ var(--m) center / calc(100% - var(--d)) 100%,
2435
+ var(--c) 0 var(--py) / var(--d) var(--d),
2436
+ var(--c) 100% var(--py) / var(--d) var(--d),
2437
+ var(--c) 0 calc(100% - var(--py)) / var(--d) var(--d),
2438
+ var(--c) 100% calc(100% - var(--py)) / var(--d) var(--d);
2439
+ mask-repeat: no-repeat;
2440
+ }
2441
+
2442
+ /* Centred: a spacer at each end of the track, `--_cp` wide, so the first
2443
+ and the last slides can reach the middle too. Pseudo-elements, so the
2444
+ slides keep sizing from the track (a padding would shrink them); each
2445
+ cancels the gap it brings. */
2446
+ .bb-carousel--centred .bb-carousel__track {
2447
+ &::before,
2448
+ &::after {
2449
+ content: '';
2450
+ flex: 0 0 var(--_cp, 0px);
2451
+ }
2452
+
2453
+ &::before {
2454
+ margin-inline-end: calc(-1 * var(--gap));
2455
+ }
2456
+
2457
+ &::after {
2458
+ margin-inline-start: calc(-1 * var(--gap));
2459
+ }
2460
+ }
2461
+
2462
+ .bb-carousel__slide {
2463
+ /* No clip here: a card's focus ring or hover lift must not be cut. The
2464
+ built-in image rounds itself; the track keeps mid-swipe corners round. */
2465
+ flex: 0 0 calc((100% - (var(--per-view) - 1) * var(--gap)) / var(--per-view));
2466
+ min-width: 0;
2467
+ /* The overlay's box. */
2468
+ position: relative;
2469
+ }
2470
+
2471
+ /* The snap points: the page starts only, so a swipe lands on a page (every
2472
+ slide before mount). A fast flick stops at the next page, not three on. */
2473
+ .bb-carousel__slide--page {
2474
+ scroll-snap-align: start;
2475
+ scroll-snap-stop: always;
2476
+ }
2477
+
2478
+ /* With a `slide:header` / `slide:footer`, a slide is a column: given a
2479
+ height (the fill-height mode), the built-in image shrinks to make room
2480
+ for them instead of being cut; otherwise it keeps its ratio. Carousels
2481
+ without them keep the slide's plain block layout. */
2482
+ .bb-carousel--framed .bb-carousel__slide {
2483
+ display: flex;
2484
+ flex-direction: column;
2485
+
2486
+ /* The header and footer keep their size; only the image gives way. */
2487
+ > * {
2488
+ flex-shrink: 0;
2489
+ }
2490
+
2491
+ .bb-carousel__image {
2492
+ flex: 1 1 auto;
2493
+ min-height: 0;
2494
+ }
2495
+ }
2496
+
2497
+ /* The `overlay` slot: a layer the slide's size, on top of whatever the slide
2498
+ shows, bare (the content places itself). Empty, it lets taps through, so
2499
+ the slide still swipes, drags and peek-clicks there; its content takes
2500
+ them. Under the arrows, pause and dots (they sit on the root above the
2501
+ track). */
2502
+ .bb-carousel__overlay {
2503
+ border-radius: var(--r);
2504
+ inset: 0;
2505
+ pointer-events: none;
2506
+ position: absolute;
2507
+
2508
+ > * {
2509
+ pointer-events: auto;
2510
+ }
2511
+ }
2512
+
2513
+ /* The crop is `--ratio`, unless the carousel is given a height: then the
2514
+ slides stretch to it and `height: 100%` resolves, so the image fills it
2515
+ (a definite height and width win over `aspect-ratio`), cropped from the
2516
+ centre. Without one, the percentage has nothing to resolve against and
2517
+ the ratio sizes it. */
2518
+ .bb-carousel__image {
2519
+ aspect-ratio: var(--ratio);
2520
+ /* A placeholder while the file loads (or if it fails). */
2521
+ background-color: color-mix(in oklab, var(--bb-text) 8%, var(--bb-panel));
2522
+ border-radius: var(--r);
2523
+ display: block;
2524
+ height: 100%;
2525
+ object-fit: cover;
2526
+ user-select: none;
2527
+ width: 100%;
2528
+ }
2529
+
2530
+ /* Bled: the arrows sit at the bleed's edges, over the peeking slides, not
2531
+ over the first and last slides in the root. */
2532
+ .bb-carousel--bleed .bb-carousel__prev {
2533
+ inset-inline-start: calc(var(--inset) - var(--_bs));
2534
+ }
2535
+
2536
+ .bb-carousel--bleed .bb-carousel__next {
2537
+ inset-inline-end: calc(var(--inset) - var(--_be));
2538
+ }
2539
+
2540
+ /* Bled to the page edge: no rounded track corners out there, and the focus
2541
+ ring drawn inside. */
2542
+ .bb-carousel--bleed .bb-carousel__track {
2543
+ --_tr: 0px;
2544
+
2545
+ &:focus-visible {
2546
+ outline-offset: calc(-1 * var(--bb-ring-size));
2547
+ }
2548
+ }
2549
+
2550
+ /* Mouse drag (touch and trackpads scroll natively): a grab cursor on a
2551
+ precise pointer, snap off while the mouse holds the track. */
2552
+ @media (hover: hover) and (pointer: fine) {
2553
+ .bb-carousel--draggable .bb-carousel__track {
2554
+ cursor: grab;
2555
+ }
2556
+ }
2557
+
2558
+ .bb-carousel--dragging .bb-carousel__track {
2559
+ cursor: grabbing;
2560
+ scroll-behavior: auto;
2561
+ scroll-snap-type: none;
2562
+ user-select: none;
2563
+ }
2564
+
2565
+ /* Loop: a touch drags through pointer events (the browser's own scroll
2566
+ would race the hop back from the clones), so only a downward gesture
2567
+ (the page scroll) and pinch zoom stay the browser's. A sideways gesture
2568
+ reaches the component; a downward one ends it with a pointercancel. */
2569
+ .bb-carousel--loop .bb-carousel__track {
2570
+ touch-action: pan-y pinch-zoom;
2571
+ }
2572
+
2573
+ /* ---- Arrows: round, over the slides ----
2574
+ A translucent panel and a soft shadow, so the button reads on a light
2575
+ photo and on a dark one, in either scheme. The focus ring is the outline,
2576
+ as on BbButton. */
2577
+ .bb-carousel__arrow {
2578
+ align-items: center;
2579
+ aspect-ratio: 1;
2580
+ backdrop-filter: blur(8px);
2581
+ /* 60%: the glyph keeps 3:1 over any photo in both schemes (dark mode over
2582
+ white is the worst case; 55% is the floor). */
2583
+ background-color: color-mix(in oklab, var(--bb-panel) 60%, transparent);
2584
+ border: 0;
2585
+ border-radius: 999px;
2586
+ box-shadow: var(--bb-shadow);
2587
+ color: var(--bb-text);
2588
+ cursor: pointer;
2589
+ display: inline-flex;
2590
+ /* Its own height, not the aspect ratio's: between two insets an auto
2591
+ height stretches to them in current Chromium. */
2592
+ height: var(--arrow);
2593
+ /* Centred by auto margins between two zero insets, as the dots are, not
2594
+ by `translate`: one pair moves it (`pt:next="top-auto bottom-3"`) and
2595
+ `translate` stays free for a consumer's own. */
2596
+ inset-block: 0;
2597
+ justify-content: center;
2598
+ margin-block: auto;
2599
+ /* Hidden at rest; shown on hover and with keyboard focus (below). */
2600
+ opacity: 0;
2601
+ outline: var(--bb-ring-size) solid transparent;
2602
+ outline-offset: 2px;
2603
+ padding: 0;
2604
+ pointer-events: none;
2605
+ position: absolute;
2606
+ transition:
2607
+ background-color var(--bb-transition-fast) var(--bb-ease),
2608
+ opacity var(--bb-transition-fast) var(--bb-ease),
2609
+ outline-color var(--bb-transition-fast) var(--bb-ease);
2610
+ width: var(--arrow);
2611
+ z-index: 1;
2612
+
2613
+ &:hover {
2614
+ background-color: var(--bb-panel);
2615
+ }
2616
+
2617
+ &:focus-visible {
2618
+ outline-color: var(--bb-ring);
2619
+ }
2620
+
2621
+ /* One look for both: the same size, the same outlined glyph. */
2622
+ svg {
2623
+ fill: none;
2624
+ height: 50%;
2625
+ stroke: currentColor;
2626
+ stroke-linecap: round;
2627
+ stroke-linejoin: round;
2628
+ stroke-width: 1.75;
2629
+ width: 50%;
2630
+ }
2631
+
2632
+ &:dir(rtl) svg {
2633
+ transform: scaleX(-1);
2634
+ }
2635
+ }
2636
+
2637
+ .bb-carousel__prev {
2638
+ inset-inline-start: var(--inset);
2639
+ }
2640
+
2641
+ .bb-carousel__next {
2642
+ inset-inline-end: var(--inset);
2643
+ }
2644
+
2645
+ /* Arrows (`.bb-carousel__arrow`, above) are hidden at rest, shown on hover
2646
+ and whenever keyboard focus is inside: opacity only, so a hidden arrow
2647
+ stays focusable and named. A dead arrow (an end without `loop`) stays
2648
+ hidden unless it holds the focus, dimmed: Enter pressed to the end must
2649
+ not leave focus on an invisible button. */
2650
+ .bb-carousel:has(:focus-visible) .bb-carousel__arrow {
2651
+ opacity: 1;
2652
+ pointer-events: auto;
2653
+ }
2654
+
2655
+ /* Touch (`hover: none`): never revealed by a tap; the swipe is the gesture. */
2656
+ @media (hover: hover) {
2657
+ .bb-carousel:hover .bb-carousel__arrow {
2658
+ opacity: 1;
2659
+ pointer-events: auto;
2660
+ }
2661
+ }
2662
+
2663
+ .bb-carousel .bb-carousel__arrow[aria-disabled='true'] {
2664
+ cursor: default;
2665
+ opacity: 0;
2666
+ pointer-events: none;
2667
+
2668
+ &:focus-visible {
2669
+ opacity: 0.5;
2670
+ }
2671
+ }
2672
+
2673
+ /* ---- Dots: over the slides at the bottom centre ----
2674
+ Light dots on a dark translucent pill, so they read on a near-white photo:
2675
+ there the inactive dot holds 3:1 against the pill (`--dot` 80% white over
2676
+ 50% black on white = 3.2:1); on darker photos the pill only gets darker. */
2677
+ .bb-carousel__dots {
2678
+ align-items: center;
2679
+ backdrop-filter: blur(8px);
2680
+ background-color: rgb(0 0 0 / 0.1);
2681
+ border-radius: 999px;
2682
+ display: flex;
2683
+ /* 6px between dots; the pill 12px tall, every dot 5px from its ends. */
2684
+ gap: 6px;
2685
+ inset-block-end: var(--inset);
2686
+ /* Centred by auto margins between two zero insets, not by `translate`:
2687
+ that property stays free for a consumer's `pt:dots` (a `translate-y-*`
2688
+ utility would otherwise replace the centring). */
2689
+ inset-inline: 0;
2690
+ margin-inline: auto;
2691
+ padding: 3px 5px;
2692
+ position: absolute;
2693
+ width: fit-content;
2694
+ z-index: 1;
2695
+ }
2696
+
2697
+ /* The dots themselves, inside the pill (the "Slides" group), after the
2698
+ rotation control. */
2699
+ .bb-carousel__dot-list {
2700
+ align-items: center;
2701
+ display: flex;
2702
+ gap: 6px;
2703
+ }
2704
+
2705
+ /* The rotation control: first in the pill, a dot-sized glyph in the dots'
2706
+ colour, so it never sits on the slides' content and reads as one of the
2707
+ controls; shown whenever the dots are (a touch screen never hovers, and
2708
+ autoplay must always be stoppable). Its click surface, like a dot's, is
2709
+ an invisible `::before`. */
2710
+ .bb-carousel__pause {
2711
+ align-items: center;
2712
+ background: none;
2713
+ border: 0;
2714
+ border-radius: 999px;
2715
+ color: var(--dot-active);
2716
+ cursor: pointer;
2717
+ display: inline-flex;
2718
+ flex: none;
2719
+ height: 12px;
2720
+ justify-content: center;
2721
+ outline: var(--bb-ring-size) solid transparent;
2722
+ outline-offset: 2px;
2723
+ padding: 0;
2724
+ position: relative;
2725
+ transition: outline-color var(--bb-transition-fast);
2726
+ width: 12px;
2727
+
2728
+ &::before {
2729
+ content: '';
2730
+ inset: -3px;
2731
+ position: absolute;
2732
+ }
2733
+
2734
+ &:focus-visible {
2735
+ outline-color: var(--dot-active);
2736
+ }
2737
+
2738
+ svg {
2739
+ fill: currentColor;
2740
+ height: 10px;
2741
+ width: 10px;
2742
+ }
2743
+ }
2744
+
2745
+ /* Below the slides: when they are not all built-in images (cards, markup,
2746
+ the `slide` slot), dots laid over them would land on the content. The
2747
+ root reserves a band for the row and the dots take page colours (a
2748
+ consumer's own `--dot` / `--dot-active` on the root still win: they sit
2749
+ in a later layer). The arrows stay centred on the slides, not on slides
2750
+ plus band. */
2751
+ .bb-carousel--dots-below {
2752
+ --_dots-band: 24px;
2753
+ --dot: var(--bb-text-muted);
2754
+ --dot-active: var(--bb-text);
2755
+ padding-block-end: var(--_dots-band);
2756
+
2757
+ .bb-carousel__dots {
2758
+ backdrop-filter: none;
2759
+ background-color: transparent;
2760
+ inset-block-end: 0;
2761
+ }
2762
+
2763
+ .bb-carousel__arrow {
2764
+ inset-block-end: var(--_dots-band);
2765
+ }
2766
+ }
2767
+
2768
+ /* The button IS the dot: 6px, the current one a 16px pill, so `pt:dot`
2769
+ (a background, a size) styles exactly what is seen. Its click surface is
2770
+ an invisible `::before`, half the 6px gap out on each side and the pill's
2771
+ 12px height, so neighbours meet and never overlap. Taller surfaces: the
2772
+ touch block below. */
2773
+ .bb-carousel__dot {
2774
+ background-color: var(--dot);
2775
+ border: 0;
2776
+ border-radius: 999px;
2777
+ cursor: pointer;
2778
+ flex: none;
2779
+ height: 6px;
2780
+ outline: var(--bb-ring-size) solid transparent;
2781
+ outline-offset: 2px;
2782
+ padding: 0;
2783
+ position: relative;
2784
+ transition:
2785
+ width var(--bb-transition-medium) var(--bb-ease),
2786
+ scale var(--bb-transition-medium) var(--bb-ease),
2787
+ background-color var(--bb-transition-fast),
2788
+ outline-color var(--bb-transition-fast);
2789
+ width: 6px;
2790
+
2791
+ &::before {
2792
+ content: '';
2793
+ inset: -3px;
2794
+ position: absolute;
2795
+ }
2796
+
2797
+ &:hover {
2798
+ background-color: var(--dot-active);
2799
+ }
2800
+
2801
+ &:focus-visible {
2802
+ outline-color: var(--dot-active);
2803
+ }
2804
+
2805
+ &.bb-carousel__dot--active {
2806
+ background-color: var(--dot-active);
2807
+ width: 16px;
2808
+ }
2809
+ }
2810
+
2811
+ /* ---- Many positions: a running window of 7 dots ----
2812
+ The pill fits 7 dots (6 at 6px, the current one 16px, 6px apart) and
2813
+ clips the rest; every dot shifts by `--start` 12px slots (a dot and its
2814
+ gap; set inline), all inactive before the window, so the strip slides
2815
+ under a fixed pill. The
2816
+ edge dots shrink while more lie beyond. */
2817
+ .bb-carousel__dots--window .bb-carousel__dot-list {
2818
+ box-sizing: content-box;
2819
+ overflow: hidden;
2820
+ width: calc(6 * 12px + 16px);
2821
+
2822
+ .bb-carousel__dot {
2823
+ transition:
2824
+ width var(--bb-transition-medium) var(--bb-ease),
2825
+ scale var(--bb-transition-medium) var(--bb-ease),
2826
+ translate var(--bb-transition-medium) var(--bb-ease),
2827
+ background-color var(--bb-transition-fast),
2828
+ outline-color var(--bb-transition-fast);
2829
+ translate: calc(var(--start, 0) * -12px) 0;
2830
+ }
2831
+
2832
+ &:dir(rtl) .bb-carousel__dot {
2833
+ translate: calc(var(--start, 0) * 12px) 0;
2834
+ }
2835
+ }
2836
+
2837
+ .bb-carousel__dot--near {
2838
+ scale: 0.75;
2839
+ }
2840
+
2841
+ .bb-carousel__dot--far {
2842
+ scale: 0.5;
2843
+ }
2844
+
2845
+ /* ---- Touch: 44px targets, nothing moves (the R12 pattern) ----
2846
+ Invisible areas centred on each control. The arrows never show on touch
2847
+ (the swipe is the gesture); the pause button is alone where it sits; the
2848
+ dots sit flush in their row, so theirs grow only in height. */
2849
+ @media (pointer: coarse) {
2850
+ .bb-carousel {
2851
+ --hit: 44px;
2852
+ }
2853
+
2854
+ .bb-carousel__arrow::after {
2855
+ content: '';
2856
+ inset: min(0px, calc(50% - var(--hit) / 2));
2857
+ position: absolute;
2858
+ }
2859
+
2860
+ /* The dot's and the pause's own click surfaces, 44px tall. A dot keeps
2861
+ its slot's width; the pause, first in the row, grows outwards (away from
2862
+ the dots) to 44px wide, never over the first dot's surface. */
2863
+ .bb-carousel__dot::before,
2864
+ .bb-carousel__pause::before {
2865
+ inset-block: calc(50% - var(--hit) / 2);
2866
+ }
2867
+
2868
+ .bb-carousel__pause::before {
2869
+ inset-inline-start: calc(12px - var(--hit));
2870
+ }
2871
+ }
2872
+
2873
+ @media (prefers-reduced-motion: reduce) {
2874
+ .bb-carousel__arrow,
2875
+ .bb-carousel__pause,
2876
+ .bb-carousel__dot,
2877
+ .bb-carousel__dots--window .bb-carousel__dot {
2878
+ transition: none;
2879
+ }
2880
+ }
2881
+
2882
+ @media (forced-colors: active) {
2883
+ .bb-carousel__dots {
2884
+ background-color: Canvas;
2885
+ border: 1px solid CanvasText;
2886
+ }
2887
+
2888
+ .bb-carousel__dot {
2889
+ background-color: CanvasText;
2890
+ forced-color-adjust: none;
2891
+ }
2892
+
2893
+ .bb-carousel__dot--active {
2894
+ background-color: Highlight;
2895
+ }
2896
+ }
2897
+ ```