vectis-ui 0.13.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (387) hide show
  1. package/dist/components/VAccordion/VAccordion.js.map +1 -1
  2. package/dist/components/VAccordion/VAccordion.vue_vue_type_script_setup_true_lang.js.map +1 -1
  3. package/dist/components/VAccordion/VAccordionItem.js.map +1 -1
  4. package/dist/components/VAccordion/VAccordionItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
  5. package/dist/components/VAccordion/context.js.map +1 -1
  6. package/dist/components/VAlert/VAlert.js.map +1 -1
  7. package/dist/components/VAlert/VAlert.vue_vue_type_script_setup_true_lang.js.map +1 -1
  8. package/dist/components/VAvatar/VAvatar.js.map +1 -1
  9. package/dist/components/VAvatar/VAvatar.vue_vue_type_script_setup_true_lang.js.map +1 -1
  10. package/dist/components/VAvatar/VAvatarGroup.js.map +1 -1
  11. package/dist/components/VAvatar/VAvatarGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
  12. package/dist/components/VAvatar/context.js.map +1 -1
  13. package/dist/components/VBadge/VBadge.js.map +1 -1
  14. package/dist/components/VBadge/VBadge.vue_vue_type_script_setup_true_lang.js +1 -1
  15. package/dist/components/VBadge/VBadge.vue_vue_type_script_setup_true_lang.js.map +1 -1
  16. package/dist/components/VBreadcrumb/VBreadcrumb.js.map +1 -1
  17. package/dist/components/VBreadcrumb/VBreadcrumb.vue_vue_type_script_setup_true_lang.js.map +1 -1
  18. package/dist/components/VButton/VButton.js.map +1 -1
  19. package/dist/components/VButton/VButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
  20. package/dist/components/VButton/VButtonGroup.js.map +1 -1
  21. package/dist/components/VButton/VButtonGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
  22. package/dist/components/VButton/context.js.map +1 -1
  23. package/dist/components/VCalendar/VCalendar.js.map +1 -1
  24. package/dist/components/VCalendar/VCalendar.vue_vue_type_script_setup_true_lang.js.map +1 -1
  25. package/dist/components/VCalendar/VCalendarEvent.js.map +1 -1
  26. package/dist/components/VCalendar/VCalendarEvent.vue_vue_type_script_setup_true_lang.js.map +1 -1
  27. package/dist/components/VCalendar/VCalendarMonth.js.map +1 -1
  28. package/dist/components/VCalendar/VCalendarMonth.vue_vue_type_script_setup_true_lang.js +5 -17
  29. package/dist/components/VCalendar/VCalendarMonth.vue_vue_type_script_setup_true_lang.js.map +1 -1
  30. package/dist/components/VCalendar/VCalendarTimeGrid.js.map +1 -1
  31. package/dist/components/VCalendar/VCalendarTimeGrid.vue_vue_type_script_setup_true_lang.js +19 -31
  32. package/dist/components/VCalendar/VCalendarTimeGrid.vue_vue_type_script_setup_true_lang.js.map +1 -1
  33. package/dist/components/VCalendar/VCalendarYear.js.map +1 -1
  34. package/dist/components/VCalendar/VCalendarYear.vue_vue_type_script_setup_true_lang.js.map +1 -1
  35. package/dist/components/VCalendar/color.js.map +1 -1
  36. package/dist/components/VCalendar/edgeStep.js +1 -5
  37. package/dist/components/VCalendar/edgeStep.js.map +1 -1
  38. package/dist/components/VCalendar/gesture.js +4 -12
  39. package/dist/components/VCalendar/gesture.js.map +1 -1
  40. package/dist/components/VCalendar/keyboard.js.map +1 -1
  41. package/dist/components/VCalendar/layout.js +8 -12
  42. package/dist/components/VCalendar/layout.js.map +1 -1
  43. package/dist/components/VCalendar/timeGrid.js +5 -5
  44. package/dist/components/VCalendar/timeGrid.js.map +1 -1
  45. package/dist/components/VCard/VCard.js.map +1 -1
  46. package/dist/components/VCard/VCard.vue_vue_type_script_setup_true_lang.js.map +1 -1
  47. package/dist/components/VCarousel/VCarousel.js.map +1 -1
  48. package/dist/components/VCarousel/VCarousel.vue_vue_type_script_setup_true_lang.js.map +1 -1
  49. package/dist/components/VCarousel/VCarouselItem.js.map +1 -1
  50. package/dist/components/VCarousel/VCarouselItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
  51. package/dist/components/VCarousel/context.js.map +1 -1
  52. package/dist/components/VCheckbox/VCheckMark.js.map +1 -1
  53. package/dist/components/VCheckbox/VCheckMark.vue_vue_type_script_setup_true_lang.js.map +1 -1
  54. package/dist/components/VCheckbox/VCheckbox.js.map +1 -1
  55. package/dist/components/VCheckbox/VCheckbox.vue_vue_type_script_setup_true_lang.js.map +1 -1
  56. package/dist/components/VChip/VChip.js.map +1 -1
  57. package/dist/components/VChip/VChip.vue_vue_type_script_setup_true_lang.js.map +1 -1
  58. package/dist/components/VColorInput/VColorInput.js.map +1 -1
  59. package/dist/components/VColorInput/VColorInput.vue_vue_type_script_setup_true_lang.js +62 -62
  60. package/dist/components/VColorInput/VColorInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
  61. package/dist/components/VColorPicker/VColorPicker.css +1 -1
  62. package/dist/components/VColorPicker/VColorPicker.js.map +1 -1
  63. package/dist/components/VColorPicker/VColorPicker.vue_vue_type_script_setup_true_lang.js +1 -5
  64. package/dist/components/VColorPicker/VColorPicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
  65. package/dist/components/VColorPicker/color.js.map +1 -1
  66. package/dist/components/VCombobox/VCombobox.js.map +1 -1
  67. package/dist/components/VCombobox/VCombobox.vue_vue_type_script_setup_true_lang.js +114 -122
  68. package/dist/components/VCombobox/VCombobox.vue_vue_type_script_setup_true_lang.js.map +1 -1
  69. package/dist/components/VCommandPalette/VCommandPalette.css +1 -1
  70. package/dist/components/VCommandPalette/VCommandPalette.js.map +1 -1
  71. package/dist/components/VCommandPalette/VCommandPalette.vue_vue_type_script_setup_true_lang.js +0 -1
  72. package/dist/components/VCommandPalette/VCommandPalette.vue_vue_type_script_setup_true_lang.js.map +1 -1
  73. package/dist/components/VCommandPalette/VCommandPaletteItem.js.map +1 -1
  74. package/dist/components/VCommandPalette/VCommandPaletteItem.vue_vue_type_script_setup_true_lang.js +1 -5
  75. package/dist/components/VCommandPalette/VCommandPaletteItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
  76. package/dist/components/VContextMenu/VContextMenu.js.map +1 -1
  77. package/dist/components/VContextMenu/VContextMenu.vue_vue_type_script_setup_true_lang.js +3 -5
  78. package/dist/components/VContextMenu/VContextMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  79. package/dist/components/VDataTable/VDataTable.js.map +1 -1
  80. package/dist/components/VDataTable/VDataTable.vue_vue_type_script_setup_true_lang.js +7 -10
  81. package/dist/components/VDataTable/VDataTable.vue_vue_type_script_setup_true_lang.js.map +1 -1
  82. package/dist/components/VDateInput/VDateInput.js.map +1 -1
  83. package/dist/components/VDateInput/VDateInput.vue_vue_type_script_setup_true_lang.js +35 -35
  84. package/dist/components/VDateInput/VDateInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
  85. package/dist/components/VDateInput/mask.js.map +1 -1
  86. package/dist/components/VDatePicker/VDatePicker.js.map +1 -1
  87. package/dist/components/VDatePicker/VDatePicker.vue_vue_type_script_setup_true_lang.js +2 -1
  88. package/dist/components/VDatePicker/VDatePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
  89. package/dist/components/VDatePicker/keyboard.js.map +1 -1
  90. package/dist/components/VDatePicker/names.js.map +1 -1
  91. package/dist/components/VDialog/VDialog.js.map +1 -1
  92. package/dist/components/VDialog/VDialog.vue_vue_type_script_setup_true_lang.js.map +1 -1
  93. package/dist/components/VDialog/VDialogAlert.js.map +1 -1
  94. package/dist/components/VDialog/VDialogAlert.vue_vue_type_script_setup_true_lang.js.map +1 -1
  95. package/dist/components/VDrawer/VDrawer.js.map +1 -1
  96. package/dist/components/VDrawer/VDrawer.vue_vue_type_script_setup_true_lang.js.map +1 -1
  97. package/dist/components/VEmptyState/VEmptyState.js.map +1 -1
  98. package/dist/components/VEmptyState/VEmptyState.vue_vue_type_script_setup_true_lang.js.map +1 -1
  99. package/dist/components/VField/VField.js.map +1 -1
  100. package/dist/components/VField/VField.vue_vue_type_script_setup_true_lang.js.map +1 -1
  101. package/dist/components/VField/VFieldAnnouncer.js.map +1 -1
  102. package/dist/components/VField/VFieldAnnouncer.vue_vue_type_script_setup_true_lang.js.map +1 -1
  103. package/dist/components/VField/VFieldMessage.js.map +1 -1
  104. package/dist/components/VField/VFieldMessage.vue_vue_type_script_setup_true_lang.js.map +1 -1
  105. package/dist/components/VFieldset/VFieldset.js.map +1 -1
  106. package/dist/components/VFieldset/VFieldset.vue_vue_type_script_setup_true_lang.js.map +1 -1
  107. package/dist/components/VFileInput/VFileInput.js.map +1 -1
  108. package/dist/components/VFileInput/VFileInput.vue_vue_type_script_setup_true_lang.js +85 -85
  109. package/dist/components/VFileInput/VFileInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
  110. package/dist/components/VFileInput/truncate.js.map +1 -1
  111. package/dist/components/VFilePicker/VFilePicker.js.map +1 -1
  112. package/dist/components/VFilePicker/VFilePicker.vue_vue_type_script_setup_true_lang.js +1 -1
  113. package/dist/components/VFilePicker/VFilePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
  114. package/dist/components/VFilePicker/fileKind.js.map +1 -1
  115. package/dist/components/VHotkeys/VHotkeys.js.map +1 -1
  116. package/dist/components/VHotkeys/VHotkeys.vue_vue_type_script_setup_true_lang.js.map +1 -1
  117. package/dist/components/VHotkeys/platform.js +1 -1
  118. package/dist/components/VHotkeys/platform.js.map +1 -1
  119. package/dist/components/VHoverCard/VHoverCard.js.map +1 -1
  120. package/dist/components/VHoverCard/VHoverCard.vue_vue_type_script_setup_true_lang.js +2 -12
  121. package/dist/components/VHoverCard/VHoverCard.vue_vue_type_script_setup_true_lang.js.map +1 -1
  122. package/dist/components/VIcon/VIcon.js.map +1 -1
  123. package/dist/components/VIcon/VIcon.vue_vue_type_script_setup_true_lang.js.map +1 -1
  124. package/dist/components/VIcon/iconProps.js.map +1 -1
  125. package/dist/components/VIcon/icons/add.js.map +1 -1
  126. package/dist/components/VIcon/icons/arrow_downward.js.map +1 -1
  127. package/dist/components/VIcon/icons/arrow_downward_alt.js.map +1 -1
  128. package/dist/components/VIcon/icons/arrow_drop_down.js.map +1 -1
  129. package/dist/components/VIcon/icons/arrow_drop_up.js.map +1 -1
  130. package/dist/components/VIcon/icons/arrow_left_alt.js.map +1 -1
  131. package/dist/components/VIcon/icons/arrow_right_alt.js.map +1 -1
  132. package/dist/components/VIcon/icons/arrow_upward.js.map +1 -1
  133. package/dist/components/VIcon/icons/arrow_upward_alt.js.map +1 -1
  134. package/dist/components/VIcon/icons/attach_file.js.map +1 -1
  135. package/dist/components/VIcon/icons/audio_file.js.map +1 -1
  136. package/dist/components/VIcon/icons/calendar_today.js.map +1 -1
  137. package/dist/components/VIcon/icons/check.js.map +1 -1
  138. package/dist/components/VIcon/icons/check_circle.js.map +1 -1
  139. package/dist/components/VIcon/icons/chevron_left.js.map +1 -1
  140. package/dist/components/VIcon/icons/chevron_right.js.map +1 -1
  141. package/dist/components/VIcon/icons/close.js.map +1 -1
  142. package/dist/components/VIcon/icons/cloud_upload.js.map +1 -1
  143. package/dist/components/VIcon/icons/code.js.map +1 -1
  144. package/dist/components/VIcon/icons/colorize.js.map +1 -1
  145. package/dist/components/VIcon/icons/description.js.map +1 -1
  146. package/dist/components/VIcon/icons/error.js.map +1 -1
  147. package/dist/components/VIcon/icons/expand_less.js.map +1 -1
  148. package/dist/components/VIcon/icons/expand_more.js.map +1 -1
  149. package/dist/components/VIcon/icons/first_page.js.map +1 -1
  150. package/dist/components/VIcon/icons/folder_zip.js.map +1 -1
  151. package/dist/components/VIcon/icons/image.js.map +1 -1
  152. package/dist/components/VIcon/icons/inbox.js.map +1 -1
  153. package/dist/components/VIcon/icons/index.js.map +1 -1
  154. package/dist/components/VIcon/icons/info.js.map +1 -1
  155. package/dist/components/VIcon/icons/last_page.js.map +1 -1
  156. package/dist/components/VIcon/icons/more_horiz.js.map +1 -1
  157. package/dist/components/VIcon/icons/names.js.map +1 -1
  158. package/dist/components/VIcon/icons/notifications.js.map +1 -1
  159. package/dist/components/VIcon/icons/open_in_new.js.map +1 -1
  160. package/dist/components/VIcon/icons/picture_as_pdf.js.map +1 -1
  161. package/dist/components/VIcon/icons/priority_high.js.map +1 -1
  162. package/dist/components/VIcon/icons/remove.js.map +1 -1
  163. package/dist/components/VIcon/icons/schedule.js.map +1 -1
  164. package/dist/components/VIcon/icons/search.js.map +1 -1
  165. package/dist/components/VIcon/icons/search_off.js.map +1 -1
  166. package/dist/components/VIcon/icons/star.js.map +1 -1
  167. package/dist/components/VIcon/icons/swap_vert.js.map +1 -1
  168. package/dist/components/VIcon/icons/table_chart.js.map +1 -1
  169. package/dist/components/VIcon/icons/video_file.js.map +1 -1
  170. package/dist/components/VIcon/icons/viewBox.js.map +1 -1
  171. package/dist/components/VIcon/icons/warning.js.map +1 -1
  172. package/dist/components/VIcon/resolver.js.map +1 -1
  173. package/dist/components/VIconButton/VIconButton.js.map +1 -1
  174. package/dist/components/VIconButton/VIconButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
  175. package/dist/components/VInput/VInput.js.map +1 -1
  176. package/dist/components/VInput/VInput.vue_vue_type_script_setup_true_lang.js +20 -20
  177. package/dist/components/VInput/VInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
  178. package/dist/components/VInput/VInputGroup.js.map +1 -1
  179. package/dist/components/VInput/VInputGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
  180. package/dist/components/VInput/context.js.map +1 -1
  181. package/dist/components/VInputOTP/VInputOTP.js.map +1 -1
  182. package/dist/components/VInputOTP/VInputOTP.vue_vue_type_script_setup_true_lang.js +2 -8
  183. package/dist/components/VInputOTP/VInputOTP.vue_vue_type_script_setup_true_lang.js.map +1 -1
  184. package/dist/components/VLink/VLink.js.map +1 -1
  185. package/dist/components/VLink/VLink.vue_vue_type_script_setup_true_lang.js.map +1 -1
  186. package/dist/components/VListbox/VListboxChevron.js.map +1 -1
  187. package/dist/components/VListbox/VListboxChevron.vue_vue_type_script_setup_true_lang.js.map +1 -1
  188. package/dist/components/VListbox/VListboxGroup.js.map +1 -1
  189. package/dist/components/VListbox/VListboxGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
  190. package/dist/components/VListbox/VListboxOption.js.map +1 -1
  191. package/dist/components/VListbox/VListboxOption.vue_vue_type_script_setup_true_lang.js.map +1 -1
  192. package/dist/components/VListbox/VListboxPanel.js.map +1 -1
  193. package/dist/components/VListbox/VListboxPanel.vue_vue_type_script_setup_true_lang.js.map +1 -1
  194. package/dist/components/VListbox/VListboxSeparator.js.map +1 -1
  195. package/dist/components/VListbox/VListboxSeparator.vue_vue_type_script_setup_true_lang.js.map +1 -1
  196. package/dist/components/VListbox/VListboxValues.js.map +1 -1
  197. package/dist/components/VListbox/VListboxValues.vue_vue_type_script_setup_true_lang.js.map +1 -1
  198. package/dist/components/VMenu/VMenu.js.map +1 -1
  199. package/dist/components/VMenu/VMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  200. package/dist/components/VMenu/VMenuGroup.js.map +1 -1
  201. package/dist/components/VMenu/VMenuGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
  202. package/dist/components/VMenu/VMenuItem.js.map +1 -1
  203. package/dist/components/VMenu/VMenuItem.vue_vue_type_script_setup_true_lang.js +6 -12
  204. package/dist/components/VMenu/VMenuItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
  205. package/dist/components/VMenu/VMenuPanel.js.map +1 -1
  206. package/dist/components/VMenu/VMenuPanel.vue_vue_type_script_setup_true_lang.js +9 -10
  207. package/dist/components/VMenu/VMenuPanel.vue_vue_type_script_setup_true_lang.js.map +1 -1
  208. package/dist/components/VMenu/VMenuSeparator.js.map +1 -1
  209. package/dist/components/VMenu/VMenuSeparator.vue_vue_type_script_setup_true_lang.js.map +1 -1
  210. package/dist/components/VMenu/context.js.map +1 -1
  211. package/dist/components/VMeter/VMeter.js.map +1 -1
  212. package/dist/components/VMeter/VMeter.vue_vue_type_script_setup_true_lang.js.map +1 -1
  213. package/dist/components/VNumberInput/VNumberInput.js.map +1 -1
  214. package/dist/components/VNumberInput/VNumberInput.vue_vue_type_script_setup_true_lang.js +86 -85
  215. package/dist/components/VNumberInput/VNumberInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
  216. package/dist/components/VNumberInput/number.d.ts +2 -2
  217. package/dist/components/VNumberInput/number.js +1 -1
  218. package/dist/components/VNumberInput/number.js.map +1 -1
  219. package/dist/components/VPagination/VPagination.js.map +1 -1
  220. package/dist/components/VPagination/VPagination.vue_vue_type_script_setup_true_lang.js +1 -1
  221. package/dist/components/VPagination/VPagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
  222. package/dist/components/VPopover/VPopover.js.map +1 -1
  223. package/dist/components/VPopover/VPopover.vue_vue_type_script_setup_true_lang.js.map +1 -1
  224. package/dist/components/VProgressCircular/VProgressCircular.js.map +1 -1
  225. package/dist/components/VProgressCircular/VProgressCircular.vue_vue_type_script_setup_true_lang.js.map +1 -1
  226. package/dist/components/VProgressLinear/VProgressLinear.js.map +1 -1
  227. package/dist/components/VProgressLinear/VProgressLinear.vue_vue_type_script_setup_true_lang.js.map +1 -1
  228. package/dist/components/VRadio/VRadio.js.map +1 -1
  229. package/dist/components/VRadio/VRadio.vue_vue_type_script_setup_true_lang.js.map +1 -1
  230. package/dist/components/VRating/VRating.js.map +1 -1
  231. package/dist/components/VRating/VRating.vue_vue_type_script_setup_true_lang.js.map +1 -1
  232. package/dist/components/VResizable/VResizable.js.map +1 -1
  233. package/dist/components/VResizable/VResizable.vue_vue_type_script_setup_true_lang.js +8 -6
  234. package/dist/components/VResizable/VResizable.vue_vue_type_script_setup_true_lang.js.map +1 -1
  235. package/dist/components/VResizable/VResizablePanel.js.map +1 -1
  236. package/dist/components/VResizable/VResizablePanel.vue_vue_type_script_setup_true_lang.js.map +1 -1
  237. package/dist/components/VResizable/context.js.map +1 -1
  238. package/dist/components/VResizable/layout.js.map +1 -1
  239. package/dist/components/VSelect/VSelect.js.map +1 -1
  240. package/dist/components/VSelect/VSelect.vue_vue_type_script_setup_true_lang.js +182 -189
  241. package/dist/components/VSelect/VSelect.vue_vue_type_script_setup_true_lang.js.map +1 -1
  242. package/dist/components/VSeparator/VSeparator.js.map +1 -1
  243. package/dist/components/VSeparator/VSeparator.vue_vue_type_script_setup_true_lang.js.map +1 -1
  244. package/dist/components/VSideNavigation/VSideNavigation.js.map +1 -1
  245. package/dist/components/VSideNavigation/VSideNavigation.vue_vue_type_script_setup_true_lang.js +1 -1
  246. package/dist/components/VSideNavigation/VSideNavigation.vue_vue_type_script_setup_true_lang.js.map +1 -1
  247. package/dist/components/VSideNavigation/VSideNavigationGroup.js.map +1 -1
  248. package/dist/components/VSideNavigation/VSideNavigationGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
  249. package/dist/components/VSideNavigation/VSideNavigationItem.js.map +1 -1
  250. package/dist/components/VSideNavigation/VSideNavigationItem.vue_vue_type_script_setup_true_lang.js +1 -5
  251. package/dist/components/VSideNavigation/VSideNavigationItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
  252. package/dist/components/VSideNavigation/VSideNavigationSeparator.js.map +1 -1
  253. package/dist/components/VSideNavigation/context.js.map +1 -1
  254. package/dist/components/VSkeletonLoader/VSkeletonLoader.js.map +1 -1
  255. package/dist/components/VSkeletonLoader/VSkeletonLoader.vue_vue_type_script_setup_true_lang.js.map +1 -1
  256. package/dist/components/VSlider/VSlider.js.map +1 -1
  257. package/dist/components/VSlider/VSlider.vue_vue_type_script_setup_true_lang.js +22 -22
  258. package/dist/components/VSlider/VSlider.vue_vue_type_script_setup_true_lang.js.map +1 -1
  259. package/dist/components/VSnackbar/VSnackbar.js.map +1 -1
  260. package/dist/components/VSnackbar/VSnackbar.vue_vue_type_script_setup_true_lang.js.map +1 -1
  261. package/dist/components/VSnackbar/state.js.map +1 -1
  262. package/dist/components/VSpinner/VSpinner.js.map +1 -1
  263. package/dist/components/VSpinner/VSpinner.vue_vue_type_script_setup_true_lang.js.map +1 -1
  264. package/dist/components/VSplitButton/VSplitButton.js.map +1 -1
  265. package/dist/components/VSplitButton/VSplitButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
  266. package/dist/components/VStepper/VStepper.js.map +1 -1
  267. package/dist/components/VStepper/VStepper.vue_vue_type_script_setup_true_lang.js.map +1 -1
  268. package/dist/components/VSwitch/VSwitch.js.map +1 -1
  269. package/dist/components/VSwitch/VSwitch.vue_vue_type_script_setup_true_lang.js.map +1 -1
  270. package/dist/components/VTabs/VTab.js.map +1 -1
  271. package/dist/components/VTabs/VTab.vue_vue_type_script_setup_true_lang.js.map +1 -1
  272. package/dist/components/VTabs/VTabPanel.js.map +1 -1
  273. package/dist/components/VTabs/VTabPanel.vue_vue_type_script_setup_true_lang.js.map +1 -1
  274. package/dist/components/VTabs/VTabs.js.map +1 -1
  275. package/dist/components/VTabs/VTabs.vue_vue_type_script_setup_true_lang.js.map +1 -1
  276. package/dist/components/VTabs/context.js.map +1 -1
  277. package/dist/components/VTextarea/VTextarea.js.map +1 -1
  278. package/dist/components/VTextarea/VTextarea.vue_vue_type_script_setup_true_lang.js.map +1 -1
  279. package/dist/components/VTimeInput/VTimeInput.js.map +1 -1
  280. package/dist/components/VTimeInput/VTimeInput.vue_vue_type_script_setup_true_lang.js +45 -45
  281. package/dist/components/VTimeInput/VTimeInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
  282. package/dist/components/VTimeInput/search.js.map +1 -1
  283. package/dist/components/VTimePicker/VTimePicker.js.map +1 -1
  284. package/dist/components/VTimePicker/VTimePicker.vue_vue_type_script_setup_true_lang.js +10 -10
  285. package/dist/components/VTimePicker/VTimePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
  286. package/dist/components/VTimePicker/limits.js.map +1 -1
  287. package/dist/components/VTimeline/VTimeline.js.map +1 -1
  288. package/dist/components/VTimeline/VTimeline.vue_vue_type_script_setup_true_lang.js.map +1 -1
  289. package/dist/components/VTimeline/VTimelineItem.js.map +1 -1
  290. package/dist/components/VTimeline/VTimelineItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
  291. package/dist/components/VTimeline/context.js.map +1 -1
  292. package/dist/components/VTimeline/datetime.js.map +1 -1
  293. package/dist/components/VToast/VToast.js.map +1 -1
  294. package/dist/components/VToast/VToast.vue_vue_type_script_setup_true_lang.js.map +1 -1
  295. package/dist/components/VToast/VToaster.js.map +1 -1
  296. package/dist/components/VToast/VToaster.vue_vue_type_script_setup_true_lang.js +1 -1
  297. package/dist/components/VToast/VToaster.vue_vue_type_script_setup_true_lang.js.map +1 -1
  298. package/dist/components/VToast/state.js.map +1 -1
  299. package/dist/components/VToggle/VToggle.js.map +1 -1
  300. package/dist/components/VToggle/VToggle.vue_vue_type_script_setup_true_lang.js +2 -8
  301. package/dist/components/VToggle/VToggle.vue_vue_type_script_setup_true_lang.js.map +1 -1
  302. package/dist/components/VToggle/VToggleItem.js.map +1 -1
  303. package/dist/components/VToggle/VToggleItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
  304. package/dist/components/VToggle/context.js.map +1 -1
  305. package/dist/components/VTooltip/VTooltip.js.map +1 -1
  306. package/dist/components/VTooltip/VTooltip.vue_vue_type_script_setup_true_lang.js.map +1 -1
  307. package/dist/components/VTreeView/VTreeView.js.map +1 -1
  308. package/dist/components/VTreeView/VTreeView.vue_vue_type_script_setup_true_lang.js +127 -135
  309. package/dist/components/VTreeView/VTreeView.vue_vue_type_script_setup_true_lang.js.map +1 -1
  310. package/dist/components/VTypography/VTypography.js.map +1 -1
  311. package/dist/components/VTypography/VTypography.vue_vue_type_script_setup_true_lang.js.map +1 -1
  312. package/dist/components/VVirtualList/VVirtualList.js.map +1 -1
  313. package/dist/components/VVirtualList/VVirtualList.vue_vue_type_script_setup_true_lang.js.map +1 -1
  314. package/dist/composables/useAriaLabel.js.map +1 -1
  315. package/dist/composables/useChoice.js.map +1 -1
  316. package/dist/composables/useClearable.js.map +1 -1
  317. package/dist/composables/useControlShape.js.map +1 -1
  318. package/dist/composables/useDebouncedSearch.js.map +1 -1
  319. package/dist/composables/useDetailsOpen.js.map +1 -1
  320. package/dist/composables/useEscapeDismiss.js.map +1 -1
  321. package/dist/composables/useFieldIds.js.map +1 -1
  322. package/dist/composables/useFieldPanel.js +3 -7
  323. package/dist/composables/useFieldPanel.js.map +1 -1
  324. package/dist/composables/useFileDrop.js.map +1 -1
  325. package/dist/composables/useFileField.js +2 -2
  326. package/dist/composables/useFileField.js.map +1 -1
  327. package/dist/composables/useFocusoutDismiss.js.map +1 -1
  328. package/dist/composables/useHotkeyListener.js +5 -2
  329. package/dist/composables/useHotkeyListener.js.map +1 -1
  330. package/dist/composables/useIconClickHandlers.js.map +1 -1
  331. package/dist/composables/useInertLink.js.map +1 -1
  332. package/dist/composables/useInfiniteScroll.js +4 -4
  333. package/dist/composables/useInfiniteScroll.js.map +1 -1
  334. package/dist/composables/useListbox.js +3 -9
  335. package/dist/composables/useListbox.js.map +1 -1
  336. package/dist/composables/useLiveAnnouncer.js.map +1 -1
  337. package/dist/composables/useMaskedField.js +28 -48
  338. package/dist/composables/useMaskedField.js.map +1 -1
  339. package/dist/composables/useModalDialog.js +1 -1
  340. package/dist/composables/useModalDialog.js.map +1 -1
  341. package/dist/composables/usePopover.js +1 -1
  342. package/dist/composables/usePopover.js.map +1 -1
  343. package/dist/composables/useProgressValue.js.map +1 -1
  344. package/dist/composables/useRootAttrs.js.map +1 -1
  345. package/dist/composables/useSlotNodes.js.map +1 -1
  346. package/dist/composables/useTextLimit.js.map +1 -1
  347. package/dist/composables/useTimer.js.map +1 -1
  348. package/dist/composables/useTypeahead.d.ts +13 -0
  349. package/dist/composables/useTypeahead.js +23 -0
  350. package/dist/composables/useTypeahead.js.map +1 -0
  351. package/dist/composables/useVirtualList.js.map +1 -1
  352. package/dist/i18n/en.js.map +1 -1
  353. package/dist/i18n/fr.js.map +1 -1
  354. package/dist/i18n/state.d.ts +1 -1
  355. package/dist/i18n/state.js +17 -6
  356. package/dist/i18n/state.js.map +1 -1
  357. package/dist/styles.css +1 -1
  358. package/dist/tokens/css.js.map +1 -1
  359. package/dist/tokens/index.js.map +1 -1
  360. package/dist/tokens/primitives.js.map +1 -1
  361. package/dist/tokens/semantic.js.map +1 -1
  362. package/dist/tokens/themes/dark.js.map +1 -1
  363. package/dist/tokens/types.js.map +1 -1
  364. package/dist/utils/array.js.map +1 -1
  365. package/dist/utils/arrowNav.js.map +1 -1
  366. package/dist/utils/attrs.js.map +1 -1
  367. package/dist/utils/chip.js.map +1 -1
  368. package/dist/utils/clock.js +3 -1
  369. package/dist/utils/clock.js.map +1 -1
  370. package/dist/utils/css.js +1 -1
  371. package/dist/utils/css.js.map +1 -1
  372. package/dist/utils/date.js +4 -3
  373. package/dist/utils/date.js.map +1 -1
  374. package/dist/utils/direction.js.map +1 -1
  375. package/dist/utils/env.js.map +1 -1
  376. package/dist/utils/file.js +13 -31
  377. package/dist/utils/file.js.map +1 -1
  378. package/dist/utils/focus.js.map +1 -1
  379. package/dist/utils/hostWarns.js.map +1 -1
  380. package/dist/utils/ids.js.map +1 -1
  381. package/dist/utils/matcher.js.map +1 -1
  382. package/dist/utils/memo.js.map +1 -1
  383. package/dist/utils/number.js.map +1 -1
  384. package/dist/utils/text.js.map +1 -1
  385. package/dist/utils/time.js.map +1 -1
  386. package/dist/utils/vnode.js.map +1 -1
  387. package/package.json +19 -19
@@ -1 +1 @@
1
- {"version":3,"file":"VResizable.js","names":[],"sources":["../../../src/components/VResizable/VResizable.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * No native element resizes siblings, so each handle follows the APG window splitter: a focusable\n * `separator` carrying the size of its primary panel, moved with the arrow keys or dragged under\n * pointer capture. Sizes are percentages rendered as `flex-grow` weights, which needs no\n * measurement on the server.\n */\n\nimport {\n cloneVNode,\n computed,\n onMounted,\n provide,\n ref,\n shallowReactive,\n shallowRef,\n useId,\n watchEffect,\n type FunctionalComponent,\n type VNode,\n} from 'vue'\n\nimport { useSlotNodes } from '../../composables/useSlotNodes'\nimport { useMessages } from '../../i18n/state'\nimport { isRtl } from '../../utils/direction'\nimport { isDev } from '../../utils/env'\nimport { clamp } from '../../utils/number'\nimport { resizableKey, type ResizablePanelEntry } from './context'\nimport { defaultSizes, isCollapsedAt, resizeAt, type PanelLimits } from './layout'\nimport VResizablePanel from './VResizablePanel.vue'\n\n/** Which way the panels are laid out: side by side, or stacked. */\nexport type ResizableOrientation = 'horizontal' | 'vertical'\n\n/** A panel limit: a number in percent of the group, or a CSS length such as `240px`. */\nexport type ResizableLength = number | string\n\ninterface ResizableProps {\n /**\n * `horizontal` puts the panels side by side, following the direction of the text; `vertical`\n * stacks them, and the group then needs a height.\n */\n orientation?: ResizableOrientation\n /** Fixes the sizes: the handles can neither be dragged nor focused. */\n disabled?: boolean\n /** Draws a grip in the middle of every handle, which makes it easier to find. */\n grip?: boolean\n /** How far an arrow key moves a handle, in percent of the group. */\n step?: number\n}\n\nconst props = withDefaults(defineProps<ResizableProps>(), {\n orientation: 'horizontal',\n disabled: false,\n grip: false,\n step: 5,\n})\n\n/**\n * The size of each panel, in percent of the space they share, adding up to 100. Left unbound,\n * the panels start from their `defaultSize`.\n */\nconst model = defineModel<number[]>()\n\nconst emit = defineEmits<{\n /**\n * The sizes have settled: a handle was released, moved with a key, or a panel collapsed or\n * reopened. Save them here rather than on every `update:modelValue` of a drag.\n */\n change: [sizes: number[]]\n}>()\n\ndefineSlots<{\n /** The `<VResizablePanel>`s, two or more. A handle is placed between each pair. */\n default(): unknown\n}>()\n\nconst m = useMessages()\nconst baseId = useId()\nconst rootEl = ref<HTMLElement | null>(null)\nconst horizontal = computed(() => props.orientation === 'horizontal')\n\n// @ssr\n/*\n * The panels are read from the slot's VNodes, never from a registry fed at mount, which would\n * render no handle on the server. Cloning gives each panel its position and the id its handle\n * points at (the VCarousel idiom).\n */\nconst nodes = useSlotNodes()\nconst panels = computed(() => nodes.value.filter((node) => node.type === VResizablePanel))\n\nconst nodeProp = (node: VNode, camel: string, kebab: string): unknown =>\n node.props?.[camel] ?? node.props?.[kebab]\n\nconst panelId = (node: VNode, index: number) =>\n (node.props?.id as string | undefined) ?? `${baseId}-panel-${index}`\n\nconst defaults = computed(() =>\n defaultSizes(\n panels.value.map((node) => {\n const size = nodeProp(node, 'defaultSize', 'default-size')\n return size === undefined || size === null ? undefined : Number(size)\n }),\n ),\n)\n\nconst sizes = computed(() =>\n model.value?.length === panels.value.length ? model.value : defaults.value,\n)\n\nconst entries = shallowReactive(new Map<string, ResizablePanelEntry>())\nconst entryAt = (index: number) => {\n for (const entry of entries.values()) if (entry.index === index) return entry\n return undefined\n}\n\n/** Restored when a collapsed panel reopens: its size when it collapsed, by panel. */\nconst restoreSizes = new WeakMap<ResizablePanelEntry, number>()\n\n// @core\n/*\n * CSS lengths are converted at each interaction, against the space the panels share at that\n * moment. The pixels are cached so that the ARIA values can be derived reactively.\n */\nconst space = ref(0)\nconst pixels = shallowReactive(new Map<string, number>())\n\nconst lengthKey = (length: string) => `${props.orientation}:${length}`\n\nfunction percentOf(length: ResizableLength | undefined): number | undefined {\n if (length === undefined) return undefined\n if (typeof length === 'number') return length\n if (length.trim().endsWith('%')) return Number.parseFloat(length)\n const px = pixels.get(lengthKey(length))\n return px === undefined || !space.value ? undefined : (px / space.value) * 100\n}\n\nconst limits = computed<PanelLimits[]>(() =>\n panels.value.map((_, index) => {\n const entry = entryAt(index)\n const min = clamp(percentOf(entry?.minSize) ?? 0, 0, 100)\n return {\n min,\n max: clamp(percentOf(entry?.maxSize) ?? 100, min, 100),\n collapsible: !!entry?.collapsible,\n collapsedSize: clamp(percentOf(entry?.collapsedSize) ?? 0, 0, min),\n }\n }),\n)\n\n/**\n * The sizes as laid out: a collapsed panel keeps its collapsed size, and the others share the\n * rest in proportion to their weights, as `flex-grow` distributes it. `before` gives one panel\n * back the collapsed state it had before its model changed.\n */\nfunction layoutOf(before?: { index: number; collapsed: boolean }) {\n const fixed = sizes.value.map((_, i) =>\n (i === before?.index ? before.collapsed : entryAt(i)?.collapsed)\n ? limits.value[i]!.collapsedSize\n : undefined,\n )\n const fixedTotal = fixed.reduce<number>((sum, size) => sum + (size ?? 0), 0)\n const weights = sizes.value.reduce((sum, size, i) => sum + (fixed[i] === undefined ? size : 0), 0)\n return sizes.value.map(\n (size, i) => fixed[i] ?? (weights ? (size / weights) * (100 - fixedTotal) : 0),\n )\n}\n\nconst layout = computed(() => layoutOf())\n\nfunction lengthInPixels(root: HTMLElement, length: string): number {\n const probe = document.createElement('div')\n probe.style.position = 'absolute'\n probe.style.visibility = 'hidden'\n probe.style.setProperty(horizontal.value ? 'width' : 'height', length)\n root.append(probe)\n const rect = probe.getBoundingClientRect()\n probe.remove()\n return horizontal.value ? rect.width : rect.height\n}\n\n/**\n * Measures the panels as they are drawn, which accounts for CSS limits that the weights alone do\n * not show, and refreshes the converted lengths. It falls back to the computed layout when\n * nothing can be measured.\n */\nfunction measure(before?: { index: number; collapsed: boolean }): number[] {\n const root = rootEl.value\n const rects = panels.value.map((_, i) => entryAt(i)?.el?.getBoundingClientRect())\n const extents = rects.map((rect) => (rect ? (horizontal.value ? rect.width : rect.height) : 0))\n const total = extents.reduce((sum, extent) => sum + extent, 0)\n if (!root || !total || rects.some((rect) => !rect)) return layoutOf(before)\n for (const entry of entries.values())\n for (const length of [entry.minSize, entry.maxSize, entry.collapsedSize])\n if (typeof length === 'string' && !length.trim().endsWith('%'))\n pixels.set(lengthKey(length), lengthInPixels(root, length))\n space.value = total\n const laidOut = layoutOf(before)\n // Within two pixels, the difference is the 1px lines shrunk off the panels: the computed sizes\n // are kept, so the model does not fill with measurement noise. Beyond, CSS limits are at work.\n const drawn = extents.every((extent, i) => Math.abs(extent - (laidOut[i]! * total) / 100) < 2)\n return drawn ? laidOut : extents.map((extent) => (extent / total) * 100)\n}\n\nonMounted(measure)\n\nconst sameSizes = (a: readonly number[], b: readonly number[]) =>\n a.length === b.length && a.every((size, i) => Math.abs(size - b[i]!) < 0.01)\n\n/** Writes new sizes and the collapsed state they imply, remembering what collapsing panels had. */\nfunction apply(next: number[], base: readonly number[]) {\n if (!sameSizes(next, sizes.value)) model.value = next\n next.forEach((size, i) => {\n const entry = entryAt(i)\n const lim = limits.value[i]!\n if (!entry || !lim.collapsible) return\n const now = isCollapsedAt(size, lim)\n if (now && !isCollapsedAt(base[i]!, lim)) restoreSizes.set(entry, base[i]!)\n entry.setCollapsed(now)\n })\n}\n\nfunction commit(next: number[], base: readonly number[]) {\n apply(next, base)\n if (!sameSizes(next, base)) emit('change', next)\n}\n\n/**\n * The size a reopened panel returns to: the one it had when it collapsed, or its starting size,\n * within its limits.\n */\nfunction reopenSize(index: number) {\n const entry = entryAt(index)\n const lim = limits.value[index]!\n const remembered = entry && restoreSizes.get(entry)\n return clamp(remembered ?? defaults.value[index]!, lim.min, lim.max)\n}\n\n/** Collapses or reopens a panel through the handle after it, or before it for the last one. */\nfunction sizesWithCollapsed(index: number, collapse: boolean, base: readonly number[]) {\n const lim = limits.value[index]!\n const growth = (collapse ? lim.collapsedSize : reopenSize(index)) - base[index]!\n return index < base.length - 1\n ? resizeAt(base, index, growth, limits.value, 1)\n : resizeAt(base, index - 1, -growth, limits.value, 1)\n}\n\n/**\n * The panel a handle reports on and collapses: the one before it, unless only the one after it\n * can collapse, as for a sidebar on the end side.\n */\nfunction primaryOf(handle: number) {\n const before = limits.value[handle]\n const after = limits.value[handle + 1]\n return !before?.collapsible && after?.collapsible ? handle + 1 : handle\n}\n\nprovide(resizableKey, {\n get orientation() {\n return props.orientation\n },\n sizeAt: (index) => sizes.value[index] ?? 1,\n register: (id, entry) => entries.set(id, entry),\n unregister: (id) => entries.delete(id),\n // Called from the panel's pre-flush watcher: the DOM still shows the panel as it was.\n toggle(index, collapse) {\n const base = measure({ index, collapsed: !collapse })\n const lim = limits.value[index]\n if (!lim || isCollapsedAt(base[index]!, lim) === collapse) return\n commit(sizesWithCollapsed(index, collapse, base), base)\n },\n})\n\n// @keyboard\n/*\n * The arrows that run along the group move its handles, following the direction of the text.\n * Home and End give the primary panel its smallest and largest size, and Enter collapses or\n * reopens it, as the APG window splitter describes.\n */\nfunction onKeydown(handle: number, event: KeyboardEvent) {\n if (props.disabled) return\n const base = measure()\n const primary = primaryOf(handle)\n const lim = limits.value[primary]!\n // Positive when the primary panel grows, negative when it shrinks.\n const primarySign = primary === handle ? 1 : -1\n const rtl = horizontal.value && isRtl(rootEl.value)\n const back = horizontal.value ? (rtl ? 'ArrowRight' : 'ArrowLeft') : 'ArrowUp'\n const forth = horizontal.value ? (rtl ? 'ArrowLeft' : 'ArrowRight') : 'ArrowDown'\n let next: number[]\n if (event.key === back) next = resizeAt(base, handle, -props.step, limits.value, 1)\n else if (event.key === forth) next = resizeAt(base, handle, props.step, limits.value, 1)\n else if (event.key === 'Home') {\n const lowest = lim.collapsible ? lim.collapsedSize : lim.min\n next = resizeAt(base, handle, (lowest - base[primary]!) * primarySign, limits.value, 1)\n } else if (event.key === 'End')\n next = resizeAt(base, handle, (lim.max - base[primary]!) * primarySign, limits.value, 1)\n else if (event.key === 'Enter' && lim.collapsible)\n next = sizesWithCollapsed(primary, !isCollapsedAt(base[primary]!, lim), base)\n else return\n event.preventDefault()\n commit(next, base)\n}\n\ninterface Drag {\n handle: number\n pointerId: number\n origin: number\n base: number[]\n sign: number\n last: number[]\n}\n\nconst drag = shallowRef<Drag | null>(null)\n\nconst coordinate = (event: PointerEvent) => (horizontal.value ? event.clientX : event.clientY)\n\nfunction onPointerdown(handle: number, event: PointerEvent) {\n // A second pointer pressed during a drag is ignored, which leaves one finger in charge.\n if (props.disabled || event.button !== 0 || drag.value) return\n const el = event.currentTarget as HTMLElement\n const base = measure()\n if (!space.value) return\n // Prevented so that no text gets selected; the focus a press would give is given back.\n event.preventDefault()\n el.focus({ preventScroll: true })\n // @fallback\n // Synthetic pointer events have no pointer to capture; the drag then follows the handle only.\n try {\n el.setPointerCapture(event.pointerId)\n } catch {\n /* Synthetic pointers cannot be captured. */\n }\n drag.value = {\n handle,\n pointerId: event.pointerId,\n origin: coordinate(event),\n base,\n sign: horizontal.value && isRtl(rootEl.value) ? -1 : 1,\n last: base,\n }\n}\n\nfunction onPointermove(event: PointerEvent) {\n const state = drag.value\n if (!state || state.pointerId !== event.pointerId) return\n const delta = ((coordinate(event) - state.origin) / space.value) * 100 * state.sign\n state.last = resizeAt(state.base, state.handle, delta, limits.value)\n apply(state.last, state.base)\n}\n\nfunction onPointerEnd(event: PointerEvent) {\n const state = drag.value\n if (!state || state.pointerId !== event.pointerId) return\n drag.value = null\n if (!sameSizes(state.last, state.base)) emit('change', state.last)\n}\n\nconst handles = computed(() =>\n panels.value.slice(1).map((_, handle) => {\n const primary = primaryOf(handle)\n const node = panels.value[primary]!\n const lim = limits.value[primary]!\n return {\n controls: panelId(node, primary),\n label:\n (nodeProp(node, 'label', 'label') as string | undefined) ??\n m.value.resizable.panel(primary + 1),\n now: Math.round(layout.value[primary] ?? 0),\n min: Math.round(lim.collapsible ? lim.collapsedSize : lim.min),\n max: Math.round(lim.max),\n }\n }),\n)\n\n/** Renders a captured panel VNode, which `<component :is>` cannot do. */\nconst PanelNode: FunctionalComponent<{ node: VNode; index: number }> = ({ node, index }) =>\n cloneVNode(node, { index, id: panelId(node, index) })\n\n// @devwarn\nif (isDev) {\n watchEffect(() => {\n if (nodes.value.length !== panels.value.length)\n console.warn('[VResizable] Only VResizablePanel children are rendered.')\n if (model.value && model.value.length !== panels.value.length)\n console.warn(\n `[VResizable] The v-model holds ${model.value.length} sizes for ${panels.value.length} panels; the default sizes are used.`,\n )\n })\n}\n</script>\n\n<template>\n <div\n ref=\"rootEl\"\n class=\"v-resizable\"\n :data-orientation=\"orientation\"\n :data-disabled=\"disabled ? '' : undefined\"\n :data-dragging=\"drag ? '' : undefined\"\n >\n <template v-for=\"(node, index) in panels\" :key=\"node.key ?? index\">\n <!--\n A horizontal group is divided by vertical lines. `aria-orientation` is only written when\n it differs from the separator's implicit horizontal, as on VSeparator.\n -->\n <div\n v-if=\"index > 0\"\n class=\"v-resizable-handle\"\n role=\"separator\"\n :tabindex=\"disabled ? undefined : 0\"\n :aria-orientation=\"horizontal ? 'vertical' : undefined\"\n :aria-label=\"handles[index - 1]!.label\"\n :aria-controls=\"handles[index - 1]!.controls\"\n :aria-valuenow=\"handles[index - 1]!.now\"\n :aria-valuemin=\"handles[index - 1]!.min\"\n :aria-valuemax=\"handles[index - 1]!.max\"\n :aria-disabled=\"disabled || undefined\"\n :data-active=\"drag?.handle === index - 1 ? '' : undefined\"\n @keydown=\"onKeydown(index - 1, $event)\"\n @pointerdown=\"onPointerdown(index - 1, $event)\"\n @pointermove=\"onPointermove\"\n @pointerup=\"onPointerEnd\"\n @pointercancel=\"onPointerEnd\"\n @lostpointercapture=\"onPointerEnd\"\n >\n <span v-if=\"grip\" class=\"v-resizable-grip\" aria-hidden=\"true\" />\n </div>\n <PanelNode :node=\"node\" :index=\"index\" />\n </template>\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n .v-resizable {\n --resizable-hit: var(--vectis-control-size-resizable-hit);\n display: flex;\n }\n\n .v-resizable[data-orientation='vertical'] {\n flex-direction: column;\n }\n\n .v-resizable[data-dragging] {\n user-select: none;\n }\n\n .v-resizable-handle {\n position: relative;\n z-index: 1;\n flex: none;\n display: flex;\n align-items: center;\n justify-content: center;\n border: 0 solid var(--vectis-color-border);\n touch-action: none;\n transition:\n border-color var(--vectis-duration-fast) var(--vectis-ease-default),\n box-shadow var(--vectis-duration-fast) var(--vectis-ease-default);\n }\n\n /* The strip that catches the pointer, wider than the 1px line it is centred on. */\n .v-resizable-handle::before {\n content: '';\n position: absolute;\n }\n\n /* The content box stays empty so the line is exactly 1px: the grip overflows it, centred. */\n .v-resizable[data-orientation='horizontal'] > .v-resizable-handle {\n inline-size: 0;\n border-inline-start-width: 1px;\n cursor: col-resize;\n }\n\n .v-resizable[data-orientation='horizontal'] > .v-resizable-handle::before {\n inset-block: 0;\n inset-inline: calc(var(--resizable-hit) / -2);\n }\n\n .v-resizable[data-orientation='vertical'] > .v-resizable-handle {\n block-size: 0;\n border-block-start-width: 1px;\n cursor: row-resize;\n }\n\n .v-resizable[data-orientation='vertical'] > .v-resizable-handle::before {\n inset-inline: 0;\n inset-block: calc(var(--resizable-hit) / -2);\n }\n\n .v-resizable[data-dragging][data-orientation='horizontal'] {\n cursor: col-resize;\n }\n\n .v-resizable[data-dragging][data-orientation='vertical'] {\n cursor: row-resize;\n }\n\n .v-resizable-handle:is(:hover, [data-active]):not([aria-disabled]) {\n border-color: var(--vectis-color-accent);\n box-shadow: 0 0 0 1px var(--vectis-color-accent);\n }\n\n .v-resizable-handle:focus-visible {\n outline: var(--vectis-focus-ring-width) solid var(--vectis-focus-ring-color);\n outline-offset: var(--vectis-focus-ring-offset);\n }\n\n .v-resizable-grip {\n flex: none;\n border: 1px solid transparent;\n border-radius: var(--vectis-radius-pill);\n background: var(--vectis-color-border-strong);\n transition: background-color var(--vectis-duration-fast) var(--vectis-ease-default);\n }\n\n .v-resizable[data-orientation='horizontal'] > .v-resizable-handle > .v-resizable-grip {\n inline-size: var(--vectis-control-size-resizable-grip-thickness);\n block-size: var(--vectis-control-size-resizable-grip-length);\n }\n\n .v-resizable[data-orientation='vertical'] > .v-resizable-handle > .v-resizable-grip {\n inline-size: var(--vectis-control-size-resizable-grip-length);\n block-size: var(--vectis-control-size-resizable-grip-thickness);\n }\n\n .v-resizable-handle:is(:hover, [data-active]):not([aria-disabled]) .v-resizable-grip {\n background: var(--vectis-color-accent);\n }\n\n .v-resizable-handle[aria-disabled] {\n cursor: default;\n }\n\n .v-resizable-handle[aria-disabled] .v-resizable-grip {\n background: var(--vectis-color-border);\n }\n\n @media (forced-colors: active) {\n .v-resizable-handle:is(:hover, [data-active]):not([aria-disabled]) {\n border-color: Highlight;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .v-resizable-handle,\n .v-resizable-grip {\n transition: none;\n }\n }\n}\n</style>\n"],"mappings":""}
1
+ {"version":3,"file":"VResizable.js","names":["_sfc_main","VResizable_vue_vue_type_script_setup_true_lang_default","VResizable_default"],"sources":["../../../src/components/VResizable/VResizable.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * No native element resizes siblings, so each handle follows the APG window splitter: a focusable\n * `separator` carrying the size of its primary panel, moved with the arrow keys or dragged under\n * pointer capture. Sizes are percentages rendered as `flex-grow` weights, which needs no\n * measurement on the server.\n */\n\nimport {\n cloneVNode,\n computed,\n onMounted,\n provide,\n ref,\n shallowReactive,\n shallowRef,\n useId,\n watchEffect,\n type FunctionalComponent,\n type VNode,\n} from 'vue'\n\nimport { useSlotNodes } from '../../composables/useSlotNodes'\nimport { useMessages } from '../../i18n/state'\nimport { isRtl } from '../../utils/direction'\nimport { isDev } from '../../utils/env'\nimport { clamp } from '../../utils/number'\nimport { resizableKey, type ResizablePanelEntry } from './context'\nimport { defaultSizes, isCollapsedAt, resizeAt, type PanelLimits } from './layout'\nimport VResizablePanel from './VResizablePanel.vue'\n\n/** Which way the panels are laid out: side by side, or stacked. */\nexport type ResizableOrientation = 'horizontal' | 'vertical'\n\n/** A panel limit: a number in percent of the group, or a CSS length such as `240px`. */\nexport type ResizableLength = number | string\n\ninterface ResizableProps {\n /**\n * `horizontal` puts the panels side by side, following the direction of the text; `vertical`\n * stacks them, and the group then needs a height.\n */\n orientation?: ResizableOrientation\n /** Fixes the sizes: the handles can neither be dragged nor focused. */\n disabled?: boolean\n /** Draws a grip in the middle of every handle, which makes it easier to find. */\n grip?: boolean\n /** How far an arrow key moves a handle, in percent of the group. */\n step?: number\n}\n\nconst props = withDefaults(defineProps<ResizableProps>(), {\n orientation: 'horizontal',\n disabled: false,\n grip: false,\n step: 5,\n})\n\n/**\n * The size of each panel, in percent of the space they share, adding up to 100. Left unbound,\n * the panels start from their `defaultSize`.\n */\nconst model = defineModel<number[]>()\n\nconst emit = defineEmits<{\n /**\n * The sizes have settled: a handle was released, moved with a key, or a panel collapsed or\n * reopened. Save them here rather than on every `update:modelValue` of a drag.\n */\n change: [sizes: number[]]\n}>()\n\ndefineSlots<{\n /** The `<VResizablePanel>`s, two or more. A handle is placed between each pair. */\n default(): unknown\n}>()\n\nconst m = useMessages()\nconst baseId = useId()\nconst rootEl = ref<HTMLElement | null>(null)\nconst horizontal = computed(() => props.orientation === 'horizontal')\n\n// @ssr\n/*\n * The panels are read from the slot's VNodes, never from a registry fed at mount, which would\n * render no handle on the server. Cloning gives each panel its position and the id its handle\n * points at (the VCarousel idiom).\n */\nconst nodes = useSlotNodes()\nconst panels = computed(() => nodes.value.filter((node) => node.type === VResizablePanel))\n\nconst nodeProp = (node: VNode, camel: string, kebab: string): unknown =>\n node.props?.[camel] ?? node.props?.[kebab]\n\nconst panelId = (node: VNode, index: number) =>\n (node.props?.id as string | undefined) ?? `${baseId}-panel-${index}`\n\nconst defaults = computed(() =>\n defaultSizes(\n panels.value.map((node) => {\n const size = nodeProp(node, 'defaultSize', 'default-size')\n return size === undefined || size === null ? undefined : Number(size)\n }),\n ),\n)\n\nconst sizes = computed(() =>\n model.value?.length === panels.value.length ? model.value : defaults.value,\n)\n\nconst entries = shallowReactive(new Map<string, ResizablePanelEntry>())\nconst entryAt = (index: number) => {\n for (const entry of entries.values()) if (entry.index === index) return entry\n return undefined\n}\n\n/** Restored when a collapsed panel reopens: its size when it collapsed, by panel. */\nconst restoreSizes = new WeakMap<ResizablePanelEntry, number>()\n\n// @core\n/*\n * CSS lengths are converted at each interaction, against the space the panels share at that\n * moment. The pixels are cached so that the ARIA values can be derived reactively.\n */\nconst space = ref(0)\nconst pixels = shallowReactive(new Map<string, number>())\n\nconst lengthKey = (length: string) => `${props.orientation}:${length}`\n\nfunction percentOf(length: ResizableLength | undefined): number | undefined {\n if (length === undefined) return undefined\n if (typeof length === 'number') return length\n if (length.trim().endsWith('%')) return Number.parseFloat(length)\n const px = pixels.get(lengthKey(length))\n return px === undefined || !space.value ? undefined : (px / space.value) * 100\n}\n\nconst limits = computed<PanelLimits[]>(() =>\n panels.value.map((_, index) => {\n const entry = entryAt(index)\n const min = clamp(percentOf(entry?.minSize) ?? 0, 0, 100)\n return {\n min,\n max: clamp(percentOf(entry?.maxSize) ?? 100, min, 100),\n collapsible: !!entry?.collapsible,\n collapsedSize: clamp(percentOf(entry?.collapsedSize) ?? 0, 0, min),\n }\n }),\n)\n\n/**\n * The sizes as laid out: a collapsed panel keeps its collapsed size, and the others share the\n * rest in proportion to their weights, as `flex-grow` distributes it. `before` gives one panel\n * back the collapsed state it had before its model changed.\n */\nfunction layoutOf(before?: { index: number; collapsed: boolean }) {\n const fixed = sizes.value.map((_, i) =>\n (i === before?.index ? before.collapsed : entryAt(i)?.collapsed)\n ? limits.value[i]!.collapsedSize\n : undefined,\n )\n const fixedTotal = fixed.reduce<number>((sum, size) => sum + (size ?? 0), 0)\n const weights = sizes.value.reduce((sum, size, i) => sum + (fixed[i] === undefined ? size : 0), 0)\n return sizes.value.map(\n (size, i) => fixed[i] ?? (weights ? (size / weights) * (100 - fixedTotal) : 0),\n )\n}\n\nconst layout = computed(() => layoutOf())\n\nfunction lengthInPixels(root: HTMLElement, length: string): number {\n const probe = document.createElement('div')\n probe.style.position = 'absolute'\n probe.style.visibility = 'hidden'\n probe.style.setProperty(horizontal.value ? 'width' : 'height', length)\n root.append(probe)\n const rect = probe.getBoundingClientRect()\n probe.remove()\n return horizontal.value ? rect.width : rect.height\n}\n\n/**\n * Measures the panels as they are drawn, which accounts for CSS limits that the weights alone do\n * not show, and refreshes the converted lengths. It falls back to the computed layout when\n * nothing can be measured.\n */\nfunction measure(before?: { index: number; collapsed: boolean }): number[] {\n const root = rootEl.value\n const rects = panels.value.map((_, i) => entryAt(i)?.el?.getBoundingClientRect())\n const extents = rects.map((rect) => (rect ? (horizontal.value ? rect.width : rect.height) : 0))\n const total = extents.reduce((sum, extent) => sum + extent, 0)\n if (!root || !total || rects.some((rect) => !rect)) return layoutOf(before)\n for (const entry of entries.values())\n for (const length of [entry.minSize, entry.maxSize, entry.collapsedSize])\n if (typeof length === 'string' && !length.trim().endsWith('%'))\n pixels.set(lengthKey(length), lengthInPixels(root, length))\n space.value = total\n const laidOut = layoutOf(before)\n // Within two pixels, the difference is the 1px lines shrunk off the panels: the computed sizes\n // are kept, so the model does not fill with measurement noise. Beyond, CSS limits are at work.\n const drawn = extents.every((extent, i) => Math.abs(extent - (laidOut[i]! * total) / 100) < 2)\n return drawn ? laidOut : extents.map((extent) => (extent / total) * 100)\n}\n\nonMounted(measure)\n\nconst sameSizes = (a: readonly number[], b: readonly number[]) =>\n a.length === b.length && a.every((size, i) => Math.abs(size - b[i]!) < 0.01)\n\n/** Writes new sizes and the collapsed state they imply, remembering what collapsing panels had. */\nfunction apply(next: number[], base: readonly number[]) {\n if (!sameSizes(next, sizes.value)) model.value = next\n next.forEach((size, i) => {\n const entry = entryAt(i)\n const lim = limits.value[i]!\n if (!entry || !lim.collapsible) return\n const now = isCollapsedAt(size, lim)\n if (now && !isCollapsedAt(base[i]!, lim)) restoreSizes.set(entry, base[i]!)\n entry.setCollapsed(now)\n })\n}\n\nfunction commit(next: number[], base: readonly number[]) {\n apply(next, base)\n if (!sameSizes(next, base)) emit('change', next)\n}\n\n/**\n * The size a reopened panel returns to: the one it had when it collapsed, or its starting size,\n * within its limits.\n */\nfunction reopenSize(index: number) {\n const entry = entryAt(index)\n const lim = limits.value[index]!\n const remembered = entry && restoreSizes.get(entry)\n return clamp(remembered ?? defaults.value[index]!, lim.min, lim.max)\n}\n\n/** Collapses or reopens a panel through the handle after it, or before it for the last one. */\nfunction sizesWithCollapsed(index: number, collapse: boolean, base: readonly number[]) {\n const lim = limits.value[index]!\n const growth = (collapse ? lim.collapsedSize : reopenSize(index)) - base[index]!\n return index < base.length - 1\n ? resizeAt(base, index, growth, limits.value, 1)\n : resizeAt(base, index - 1, -growth, limits.value, 1)\n}\n\n/**\n * The panel a handle reports on and collapses: the one before it, unless only the one after it\n * can collapse, as for a sidebar on the end side.\n */\nfunction primaryOf(handle: number) {\n const before = limits.value[handle]\n const after = limits.value[handle + 1]\n return !before?.collapsible && after?.collapsible ? handle + 1 : handle\n}\n\nprovide(resizableKey, {\n get orientation() {\n return props.orientation\n },\n sizeAt: (index) => sizes.value[index] ?? 1,\n register: (id, entry) => entries.set(id, entry),\n unregister: (id) => entries.delete(id),\n // Called from the panel's pre-flush watcher: the DOM still shows the panel as it was.\n toggle(index, collapse) {\n const base = measure({ index, collapsed: !collapse })\n const lim = limits.value[index]\n if (!lim || isCollapsedAt(base[index]!, lim) === collapse) return\n commit(sizesWithCollapsed(index, collapse, base), base)\n },\n})\n\n// @keyboard\n/*\n * The arrows that run along the group move its handles, following the direction of the text.\n * Home and End give the primary panel its smallest and largest size, and Enter collapses or\n * reopens it, as the APG window splitter describes.\n */\nfunction onKeydown(handle: number, event: KeyboardEvent) {\n if (props.disabled) return\n const base = measure()\n const primary = primaryOf(handle)\n const lim = limits.value[primary]!\n // Positive when the primary panel grows, negative when it shrinks.\n const primarySign = primary === handle ? 1 : -1\n const rtl = horizontal.value && isRtl(rootEl.value)\n const back = horizontal.value ? (rtl ? 'ArrowRight' : 'ArrowLeft') : 'ArrowUp'\n const forth = horizontal.value ? (rtl ? 'ArrowLeft' : 'ArrowRight') : 'ArrowDown'\n let next: number[]\n if (event.key === back) next = resizeAt(base, handle, -props.step, limits.value, 1)\n else if (event.key === forth) next = resizeAt(base, handle, props.step, limits.value, 1)\n else if (event.key === 'Home') {\n const lowest = lim.collapsible ? lim.collapsedSize : lim.min\n next = resizeAt(base, handle, (lowest - base[primary]!) * primarySign, limits.value, 1)\n } else if (event.key === 'End')\n next = resizeAt(base, handle, (lim.max - base[primary]!) * primarySign, limits.value, 1)\n else if (event.key === 'Enter' && lim.collapsible)\n next = sizesWithCollapsed(primary, !isCollapsedAt(base[primary]!, lim), base)\n else return\n event.preventDefault()\n commit(next, base)\n}\n\ninterface Drag {\n handle: number\n pointerId: number\n origin: number\n base: number[]\n sign: number\n last: number[]\n}\n\nconst drag = shallowRef<Drag | null>(null)\n\nconst coordinate = (event: PointerEvent) => (horizontal.value ? event.clientX : event.clientY)\n\nfunction onPointerdown(handle: number, event: PointerEvent) {\n // A second pointer pressed during a drag is ignored, which leaves one finger in charge.\n if (props.disabled || event.button !== 0 || drag.value) return\n const el = event.currentTarget as HTMLElement\n const base = measure()\n if (!space.value) return\n // Prevented so that no text gets selected; the focus a press would give is given back.\n event.preventDefault()\n el.focus({ preventScroll: true })\n // @fallback\n // Synthetic pointer events have no pointer to capture; the drag then follows the handle only.\n try {\n el.setPointerCapture(event.pointerId)\n } catch {\n /* Synthetic pointers cannot be captured. */\n }\n drag.value = {\n handle,\n pointerId: event.pointerId,\n origin: coordinate(event),\n base,\n sign: horizontal.value && isRtl(rootEl.value) ? -1 : 1,\n last: base,\n }\n}\n\nfunction onPointermove(event: PointerEvent) {\n const state = drag.value\n if (!state || state.pointerId !== event.pointerId) return\n const delta = ((coordinate(event) - state.origin) / space.value) * 100 * state.sign\n state.last = resizeAt(state.base, state.handle, delta, limits.value)\n apply(state.last, state.base)\n}\n\nfunction onPointerEnd(event: PointerEvent) {\n const state = drag.value\n if (!state || state.pointerId !== event.pointerId) return\n drag.value = null\n if (!sameSizes(state.last, state.base)) emit('change', state.last)\n}\n\nconst handles = computed(() =>\n panels.value.slice(1).map((_, handle) => {\n const primary = primaryOf(handle)\n const node = panels.value[primary]!\n const lim = limits.value[primary]!\n return {\n controls: panelId(node, primary),\n label:\n (nodeProp(node, 'label', 'label') as string | undefined) ??\n m.value.resizable.panel(primary + 1),\n now: Math.round(layout.value[primary] ?? 0),\n min: Math.round(lim.collapsible ? lim.collapsedSize : lim.min),\n max: Math.round(lim.max),\n }\n }),\n)\n\n/** Renders a captured panel VNode, which `<component :is>` cannot do. */\nconst PanelNode: FunctionalComponent<{ node: VNode; index: number }> = ({ node, index }) =>\n cloneVNode(node, { index, id: panelId(node, index) })\n\n// @devwarn\nif (isDev) {\n watchEffect(() => {\n if (nodes.value.length !== panels.value.length)\n console.warn('[VResizable] Only VResizablePanel children are rendered.')\n if (model.value && model.value.length !== panels.value.length)\n console.warn(\n `[VResizable] The v-model holds ${model.value.length} sizes for ${panels.value.length} panels; the default sizes are used.`,\n )\n })\n}\n</script>\n\n<template>\n <div\n ref=\"rootEl\"\n class=\"v-resizable\"\n :data-orientation=\"orientation\"\n :data-disabled=\"disabled ? '' : undefined\"\n :data-dragging=\"drag ? '' : undefined\"\n >\n <template v-for=\"(node, index) in panels\" :key=\"node.key ?? index\">\n <!--\n A horizontal group is divided by vertical lines. `aria-orientation` is only written when\n it differs from the separator's implicit horizontal, as on VSeparator.\n -->\n <div\n v-if=\"index > 0\"\n class=\"v-resizable-handle\"\n role=\"separator\"\n :tabindex=\"disabled ? undefined : 0\"\n :aria-orientation=\"horizontal ? 'vertical' : undefined\"\n :aria-label=\"handles[index - 1]!.label\"\n :aria-controls=\"handles[index - 1]!.controls\"\n :aria-valuenow=\"handles[index - 1]!.now\"\n :aria-valuemin=\"handles[index - 1]!.min\"\n :aria-valuemax=\"handles[index - 1]!.max\"\n :aria-disabled=\"disabled || undefined\"\n :data-active=\"drag?.handle === index - 1 ? '' : undefined\"\n @keydown=\"onKeydown(index - 1, $event)\"\n @pointerdown=\"onPointerdown(index - 1, $event)\"\n @pointermove=\"onPointermove\"\n @pointerup=\"onPointerEnd\"\n @pointercancel=\"onPointerEnd\"\n @lostpointercapture=\"onPointerEnd\"\n >\n <span v-if=\"grip\" class=\"v-resizable-grip\" aria-hidden=\"true\" />\n </div>\n <PanelNode :node=\"node\" :index=\"index\" />\n </template>\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n .v-resizable {\n --resizable-hit: var(--vectis-control-size-resizable-hit);\n display: flex;\n }\n\n .v-resizable[data-orientation='vertical'] {\n flex-direction: column;\n }\n\n .v-resizable[data-dragging] {\n user-select: none;\n }\n\n .v-resizable-handle {\n position: relative;\n z-index: 1;\n flex: none;\n display: flex;\n align-items: center;\n justify-content: center;\n border: 0 solid var(--vectis-color-border);\n touch-action: none;\n transition:\n border-color var(--vectis-duration-fast) var(--vectis-ease-default),\n box-shadow var(--vectis-duration-fast) var(--vectis-ease-default);\n }\n\n /* The strip that catches the pointer, wider than the 1px line it is centred on. */\n .v-resizable-handle::before {\n content: '';\n position: absolute;\n }\n\n /* The content box stays empty so the line is exactly 1px: the grip overflows it, centred. */\n .v-resizable[data-orientation='horizontal'] > .v-resizable-handle {\n inline-size: 0;\n border-inline-start-width: 1px;\n cursor: col-resize;\n }\n\n .v-resizable[data-orientation='horizontal'] > .v-resizable-handle::before {\n inset-block: 0;\n inset-inline: calc(var(--resizable-hit) / -2);\n }\n\n .v-resizable[data-orientation='vertical'] > .v-resizable-handle {\n block-size: 0;\n border-block-start-width: 1px;\n cursor: row-resize;\n }\n\n .v-resizable[data-orientation='vertical'] > .v-resizable-handle::before {\n inset-inline: 0;\n inset-block: calc(var(--resizable-hit) / -2);\n }\n\n .v-resizable[data-dragging][data-orientation='horizontal'] {\n cursor: col-resize;\n }\n\n .v-resizable[data-dragging][data-orientation='vertical'] {\n cursor: row-resize;\n }\n\n .v-resizable-handle:is(:hover, [data-active]):not([aria-disabled]) {\n border-color: var(--vectis-color-accent);\n box-shadow: 0 0 0 1px var(--vectis-color-accent);\n }\n\n .v-resizable-handle:focus-visible {\n outline: var(--vectis-focus-ring-width) solid var(--vectis-focus-ring-color);\n outline-offset: var(--vectis-focus-ring-offset);\n }\n\n .v-resizable-grip {\n flex: none;\n border: 1px solid transparent;\n border-radius: var(--vectis-radius-pill);\n background: var(--vectis-color-border-strong);\n transition: background-color var(--vectis-duration-fast) var(--vectis-ease-default);\n }\n\n .v-resizable[data-orientation='horizontal'] > .v-resizable-handle > .v-resizable-grip {\n inline-size: var(--vectis-control-size-resizable-grip-thickness);\n block-size: var(--vectis-control-size-resizable-grip-length);\n }\n\n .v-resizable[data-orientation='vertical'] > .v-resizable-handle > .v-resizable-grip {\n inline-size: var(--vectis-control-size-resizable-grip-length);\n block-size: var(--vectis-control-size-resizable-grip-thickness);\n }\n\n .v-resizable-handle:is(:hover, [data-active]):not([aria-disabled]) .v-resizable-grip {\n background: var(--vectis-color-accent);\n }\n\n .v-resizable-handle[aria-disabled] {\n cursor: default;\n }\n\n .v-resizable-handle[aria-disabled] .v-resizable-grip {\n background: var(--vectis-color-border);\n }\n\n @media (forced-colors: active) {\n .v-resizable-handle:is(:hover, [data-active]):not([aria-disabled]) {\n border-color: Highlight;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .v-resizable-handle,\n .v-resizable-grip {\n transition: none;\n }\n }\n}\n</style>\n"],"mappings":""}
@@ -106,8 +106,8 @@ var x = [
106
106
  K(e, t), G(e, t) || w("change", e);
107
107
  }
108
108
  function de(e) {
109
- let t = F(e), n = V.value[e];
110
- return i((t && I.get(t)) ?? M.value[e], n.min, n.max);
109
+ let t = F(e), n = V.value[e], r = t && I.get(t);
110
+ return i(r ?? M.value[e], n.min, n.max);
111
111
  }
112
112
  function J(e, t, n) {
113
113
  let r = V.value[e], i = (t ? r.collapsedSize : de(e)) - n[e];
@@ -129,7 +129,7 @@ var x = [
129
129
  index: e,
130
130
  collapsed: !t
131
131
  }), r = V.value[e];
132
- !r || s(n[e], r) === t || q(J(e, t, n), n);
132
+ r && s(n[e], r) !== t && q(J(e, t, n), n);
133
133
  }
134
134
  });
135
135
  function fe(e, t) {
@@ -137,8 +137,10 @@ var x = [
137
137
  let n = W(), i = Y(e), a = V.value[i], o = i === e ? 1 : -1, l = D.value && r(E.value), u = D.value ? l ? "ArrowRight" : "ArrowLeft" : "ArrowUp", d = D.value ? l ? "ArrowLeft" : "ArrowRight" : "ArrowDown", f;
138
138
  if (t.key === u) f = c(n, e, -S.step, V.value, 1);
139
139
  else if (t.key === d) f = c(n, e, S.step, V.value, 1);
140
- else if (t.key === "Home") f = c(n, e, ((a.collapsible ? a.collapsedSize : a.min) - n[i]) * o, V.value, 1);
141
- else if (t.key === "End") f = c(n, e, (a.max - n[i]) * o, V.value, 1);
140
+ else if (t.key === "Home") {
141
+ let t = a.collapsible ? a.collapsedSize : a.min;
142
+ f = c(n, e, (t - n[i]) * o, V.value, 1);
143
+ } else if (t.key === "End") f = c(n, e, (a.max - n[i]) * o, V.value, 1);
142
144
  else if (t.key === "Enter" && a.collapsible) f = J(i, !s(n[i], a), n);
143
145
  else return;
144
146
  t.preventDefault(), q(f, n);
@@ -170,7 +172,7 @@ var x = [
170
172
  }
171
173
  function Q(e) {
172
174
  let t = X.value;
173
- !t || t.pointerId !== e.pointerId || (X.value = null, G(t.last, t.base) || w("change", t.last));
175
+ t && t.pointerId === e.pointerId && (X.value = null, G(t.last, t.base) || w("change", t.last));
174
176
  }
175
177
  let $ = f(() => k.value.slice(1).map((e, t) => {
176
178
  let n = Y(t), r = k.value[n], i = V.value[n];
@@ -1 +1 @@
1
- {"version":3,"file":"VResizable.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/components/VResizable/VResizable.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * No native element resizes siblings, so each handle follows the APG window splitter: a focusable\n * `separator` carrying the size of its primary panel, moved with the arrow keys or dragged under\n * pointer capture. Sizes are percentages rendered as `flex-grow` weights, which needs no\n * measurement on the server.\n */\n\nimport {\n cloneVNode,\n computed,\n onMounted,\n provide,\n ref,\n shallowReactive,\n shallowRef,\n useId,\n watchEffect,\n type FunctionalComponent,\n type VNode,\n} from 'vue'\n\nimport { useSlotNodes } from '../../composables/useSlotNodes'\nimport { useMessages } from '../../i18n/state'\nimport { isRtl } from '../../utils/direction'\nimport { isDev } from '../../utils/env'\nimport { clamp } from '../../utils/number'\nimport { resizableKey, type ResizablePanelEntry } from './context'\nimport { defaultSizes, isCollapsedAt, resizeAt, type PanelLimits } from './layout'\nimport VResizablePanel from './VResizablePanel.vue'\n\n/** Which way the panels are laid out: side by side, or stacked. */\nexport type ResizableOrientation = 'horizontal' | 'vertical'\n\n/** A panel limit: a number in percent of the group, or a CSS length such as `240px`. */\nexport type ResizableLength = number | string\n\ninterface ResizableProps {\n /**\n * `horizontal` puts the panels side by side, following the direction of the text; `vertical`\n * stacks them, and the group then needs a height.\n */\n orientation?: ResizableOrientation\n /** Fixes the sizes: the handles can neither be dragged nor focused. */\n disabled?: boolean\n /** Draws a grip in the middle of every handle, which makes it easier to find. */\n grip?: boolean\n /** How far an arrow key moves a handle, in percent of the group. */\n step?: number\n}\n\nconst props = withDefaults(defineProps<ResizableProps>(), {\n orientation: 'horizontal',\n disabled: false,\n grip: false,\n step: 5,\n})\n\n/**\n * The size of each panel, in percent of the space they share, adding up to 100. Left unbound,\n * the panels start from their `defaultSize`.\n */\nconst model = defineModel<number[]>()\n\nconst emit = defineEmits<{\n /**\n * The sizes have settled: a handle was released, moved with a key, or a panel collapsed or\n * reopened. Save them here rather than on every `update:modelValue` of a drag.\n */\n change: [sizes: number[]]\n}>()\n\ndefineSlots<{\n /** The `<VResizablePanel>`s, two or more. A handle is placed between each pair. */\n default(): unknown\n}>()\n\nconst m = useMessages()\nconst baseId = useId()\nconst rootEl = ref<HTMLElement | null>(null)\nconst horizontal = computed(() => props.orientation === 'horizontal')\n\n// @ssr\n/*\n * The panels are read from the slot's VNodes, never from a registry fed at mount, which would\n * render no handle on the server. Cloning gives each panel its position and the id its handle\n * points at (the VCarousel idiom).\n */\nconst nodes = useSlotNodes()\nconst panels = computed(() => nodes.value.filter((node) => node.type === VResizablePanel))\n\nconst nodeProp = (node: VNode, camel: string, kebab: string): unknown =>\n node.props?.[camel] ?? node.props?.[kebab]\n\nconst panelId = (node: VNode, index: number) =>\n (node.props?.id as string | undefined) ?? `${baseId}-panel-${index}`\n\nconst defaults = computed(() =>\n defaultSizes(\n panels.value.map((node) => {\n const size = nodeProp(node, 'defaultSize', 'default-size')\n return size === undefined || size === null ? undefined : Number(size)\n }),\n ),\n)\n\nconst sizes = computed(() =>\n model.value?.length === panels.value.length ? model.value : defaults.value,\n)\n\nconst entries = shallowReactive(new Map<string, ResizablePanelEntry>())\nconst entryAt = (index: number) => {\n for (const entry of entries.values()) if (entry.index === index) return entry\n return undefined\n}\n\n/** Restored when a collapsed panel reopens: its size when it collapsed, by panel. */\nconst restoreSizes = new WeakMap<ResizablePanelEntry, number>()\n\n// @core\n/*\n * CSS lengths are converted at each interaction, against the space the panels share at that\n * moment. The pixels are cached so that the ARIA values can be derived reactively.\n */\nconst space = ref(0)\nconst pixels = shallowReactive(new Map<string, number>())\n\nconst lengthKey = (length: string) => `${props.orientation}:${length}`\n\nfunction percentOf(length: ResizableLength | undefined): number | undefined {\n if (length === undefined) return undefined\n if (typeof length === 'number') return length\n if (length.trim().endsWith('%')) return Number.parseFloat(length)\n const px = pixels.get(lengthKey(length))\n return px === undefined || !space.value ? undefined : (px / space.value) * 100\n}\n\nconst limits = computed<PanelLimits[]>(() =>\n panels.value.map((_, index) => {\n const entry = entryAt(index)\n const min = clamp(percentOf(entry?.minSize) ?? 0, 0, 100)\n return {\n min,\n max: clamp(percentOf(entry?.maxSize) ?? 100, min, 100),\n collapsible: !!entry?.collapsible,\n collapsedSize: clamp(percentOf(entry?.collapsedSize) ?? 0, 0, min),\n }\n }),\n)\n\n/**\n * The sizes as laid out: a collapsed panel keeps its collapsed size, and the others share the\n * rest in proportion to their weights, as `flex-grow` distributes it. `before` gives one panel\n * back the collapsed state it had before its model changed.\n */\nfunction layoutOf(before?: { index: number; collapsed: boolean }) {\n const fixed = sizes.value.map((_, i) =>\n (i === before?.index ? before.collapsed : entryAt(i)?.collapsed)\n ? limits.value[i]!.collapsedSize\n : undefined,\n )\n const fixedTotal = fixed.reduce<number>((sum, size) => sum + (size ?? 0), 0)\n const weights = sizes.value.reduce((sum, size, i) => sum + (fixed[i] === undefined ? size : 0), 0)\n return sizes.value.map(\n (size, i) => fixed[i] ?? (weights ? (size / weights) * (100 - fixedTotal) : 0),\n )\n}\n\nconst layout = computed(() => layoutOf())\n\nfunction lengthInPixels(root: HTMLElement, length: string): number {\n const probe = document.createElement('div')\n probe.style.position = 'absolute'\n probe.style.visibility = 'hidden'\n probe.style.setProperty(horizontal.value ? 'width' : 'height', length)\n root.append(probe)\n const rect = probe.getBoundingClientRect()\n probe.remove()\n return horizontal.value ? rect.width : rect.height\n}\n\n/**\n * Measures the panels as they are drawn, which accounts for CSS limits that the weights alone do\n * not show, and refreshes the converted lengths. It falls back to the computed layout when\n * nothing can be measured.\n */\nfunction measure(before?: { index: number; collapsed: boolean }): number[] {\n const root = rootEl.value\n const rects = panels.value.map((_, i) => entryAt(i)?.el?.getBoundingClientRect())\n const extents = rects.map((rect) => (rect ? (horizontal.value ? rect.width : rect.height) : 0))\n const total = extents.reduce((sum, extent) => sum + extent, 0)\n if (!root || !total || rects.some((rect) => !rect)) return layoutOf(before)\n for (const entry of entries.values())\n for (const length of [entry.minSize, entry.maxSize, entry.collapsedSize])\n if (typeof length === 'string' && !length.trim().endsWith('%'))\n pixels.set(lengthKey(length), lengthInPixels(root, length))\n space.value = total\n const laidOut = layoutOf(before)\n // Within two pixels, the difference is the 1px lines shrunk off the panels: the computed sizes\n // are kept, so the model does not fill with measurement noise. Beyond, CSS limits are at work.\n const drawn = extents.every((extent, i) => Math.abs(extent - (laidOut[i]! * total) / 100) < 2)\n return drawn ? laidOut : extents.map((extent) => (extent / total) * 100)\n}\n\nonMounted(measure)\n\nconst sameSizes = (a: readonly number[], b: readonly number[]) =>\n a.length === b.length && a.every((size, i) => Math.abs(size - b[i]!) < 0.01)\n\n/** Writes new sizes and the collapsed state they imply, remembering what collapsing panels had. */\nfunction apply(next: number[], base: readonly number[]) {\n if (!sameSizes(next, sizes.value)) model.value = next\n next.forEach((size, i) => {\n const entry = entryAt(i)\n const lim = limits.value[i]!\n if (!entry || !lim.collapsible) return\n const now = isCollapsedAt(size, lim)\n if (now && !isCollapsedAt(base[i]!, lim)) restoreSizes.set(entry, base[i]!)\n entry.setCollapsed(now)\n })\n}\n\nfunction commit(next: number[], base: readonly number[]) {\n apply(next, base)\n if (!sameSizes(next, base)) emit('change', next)\n}\n\n/**\n * The size a reopened panel returns to: the one it had when it collapsed, or its starting size,\n * within its limits.\n */\nfunction reopenSize(index: number) {\n const entry = entryAt(index)\n const lim = limits.value[index]!\n const remembered = entry && restoreSizes.get(entry)\n return clamp(remembered ?? defaults.value[index]!, lim.min, lim.max)\n}\n\n/** Collapses or reopens a panel through the handle after it, or before it for the last one. */\nfunction sizesWithCollapsed(index: number, collapse: boolean, base: readonly number[]) {\n const lim = limits.value[index]!\n const growth = (collapse ? lim.collapsedSize : reopenSize(index)) - base[index]!\n return index < base.length - 1\n ? resizeAt(base, index, growth, limits.value, 1)\n : resizeAt(base, index - 1, -growth, limits.value, 1)\n}\n\n/**\n * The panel a handle reports on and collapses: the one before it, unless only the one after it\n * can collapse, as for a sidebar on the end side.\n */\nfunction primaryOf(handle: number) {\n const before = limits.value[handle]\n const after = limits.value[handle + 1]\n return !before?.collapsible && after?.collapsible ? handle + 1 : handle\n}\n\nprovide(resizableKey, {\n get orientation() {\n return props.orientation\n },\n sizeAt: (index) => sizes.value[index] ?? 1,\n register: (id, entry) => entries.set(id, entry),\n unregister: (id) => entries.delete(id),\n // Called from the panel's pre-flush watcher: the DOM still shows the panel as it was.\n toggle(index, collapse) {\n const base = measure({ index, collapsed: !collapse })\n const lim = limits.value[index]\n if (!lim || isCollapsedAt(base[index]!, lim) === collapse) return\n commit(sizesWithCollapsed(index, collapse, base), base)\n },\n})\n\n// @keyboard\n/*\n * The arrows that run along the group move its handles, following the direction of the text.\n * Home and End give the primary panel its smallest and largest size, and Enter collapses or\n * reopens it, as the APG window splitter describes.\n */\nfunction onKeydown(handle: number, event: KeyboardEvent) {\n if (props.disabled) return\n const base = measure()\n const primary = primaryOf(handle)\n const lim = limits.value[primary]!\n // Positive when the primary panel grows, negative when it shrinks.\n const primarySign = primary === handle ? 1 : -1\n const rtl = horizontal.value && isRtl(rootEl.value)\n const back = horizontal.value ? (rtl ? 'ArrowRight' : 'ArrowLeft') : 'ArrowUp'\n const forth = horizontal.value ? (rtl ? 'ArrowLeft' : 'ArrowRight') : 'ArrowDown'\n let next: number[]\n if (event.key === back) next = resizeAt(base, handle, -props.step, limits.value, 1)\n else if (event.key === forth) next = resizeAt(base, handle, props.step, limits.value, 1)\n else if (event.key === 'Home') {\n const lowest = lim.collapsible ? lim.collapsedSize : lim.min\n next = resizeAt(base, handle, (lowest - base[primary]!) * primarySign, limits.value, 1)\n } else if (event.key === 'End')\n next = resizeAt(base, handle, (lim.max - base[primary]!) * primarySign, limits.value, 1)\n else if (event.key === 'Enter' && lim.collapsible)\n next = sizesWithCollapsed(primary, !isCollapsedAt(base[primary]!, lim), base)\n else return\n event.preventDefault()\n commit(next, base)\n}\n\ninterface Drag {\n handle: number\n pointerId: number\n origin: number\n base: number[]\n sign: number\n last: number[]\n}\n\nconst drag = shallowRef<Drag | null>(null)\n\nconst coordinate = (event: PointerEvent) => (horizontal.value ? event.clientX : event.clientY)\n\nfunction onPointerdown(handle: number, event: PointerEvent) {\n // A second pointer pressed during a drag is ignored, which leaves one finger in charge.\n if (props.disabled || event.button !== 0 || drag.value) return\n const el = event.currentTarget as HTMLElement\n const base = measure()\n if (!space.value) return\n // Prevented so that no text gets selected; the focus a press would give is given back.\n event.preventDefault()\n el.focus({ preventScroll: true })\n // @fallback\n // Synthetic pointer events have no pointer to capture; the drag then follows the handle only.\n try {\n el.setPointerCapture(event.pointerId)\n } catch {\n /* Synthetic pointers cannot be captured. */\n }\n drag.value = {\n handle,\n pointerId: event.pointerId,\n origin: coordinate(event),\n base,\n sign: horizontal.value && isRtl(rootEl.value) ? -1 : 1,\n last: base,\n }\n}\n\nfunction onPointermove(event: PointerEvent) {\n const state = drag.value\n if (!state || state.pointerId !== event.pointerId) return\n const delta = ((coordinate(event) - state.origin) / space.value) * 100 * state.sign\n state.last = resizeAt(state.base, state.handle, delta, limits.value)\n apply(state.last, state.base)\n}\n\nfunction onPointerEnd(event: PointerEvent) {\n const state = drag.value\n if (!state || state.pointerId !== event.pointerId) return\n drag.value = null\n if (!sameSizes(state.last, state.base)) emit('change', state.last)\n}\n\nconst handles = computed(() =>\n panels.value.slice(1).map((_, handle) => {\n const primary = primaryOf(handle)\n const node = panels.value[primary]!\n const lim = limits.value[primary]!\n return {\n controls: panelId(node, primary),\n label:\n (nodeProp(node, 'label', 'label') as string | undefined) ??\n m.value.resizable.panel(primary + 1),\n now: Math.round(layout.value[primary] ?? 0),\n min: Math.round(lim.collapsible ? lim.collapsedSize : lim.min),\n max: Math.round(lim.max),\n }\n }),\n)\n\n/** Renders a captured panel VNode, which `<component :is>` cannot do. */\nconst PanelNode: FunctionalComponent<{ node: VNode; index: number }> = ({ node, index }) =>\n cloneVNode(node, { index, id: panelId(node, index) })\n\n// @devwarn\nif (isDev) {\n watchEffect(() => {\n if (nodes.value.length !== panels.value.length)\n console.warn('[VResizable] Only VResizablePanel children are rendered.')\n if (model.value && model.value.length !== panels.value.length)\n console.warn(\n `[VResizable] The v-model holds ${model.value.length} sizes for ${panels.value.length} panels; the default sizes are used.`,\n )\n })\n}\n</script>\n\n<template>\n <div\n ref=\"rootEl\"\n class=\"v-resizable\"\n :data-orientation=\"orientation\"\n :data-disabled=\"disabled ? '' : undefined\"\n :data-dragging=\"drag ? '' : undefined\"\n >\n <template v-for=\"(node, index) in panels\" :key=\"node.key ?? index\">\n <!--\n A horizontal group is divided by vertical lines. `aria-orientation` is only written when\n it differs from the separator's implicit horizontal, as on VSeparator.\n -->\n <div\n v-if=\"index > 0\"\n class=\"v-resizable-handle\"\n role=\"separator\"\n :tabindex=\"disabled ? undefined : 0\"\n :aria-orientation=\"horizontal ? 'vertical' : undefined\"\n :aria-label=\"handles[index - 1]!.label\"\n :aria-controls=\"handles[index - 1]!.controls\"\n :aria-valuenow=\"handles[index - 1]!.now\"\n :aria-valuemin=\"handles[index - 1]!.min\"\n :aria-valuemax=\"handles[index - 1]!.max\"\n :aria-disabled=\"disabled || undefined\"\n :data-active=\"drag?.handle === index - 1 ? '' : undefined\"\n @keydown=\"onKeydown(index - 1, $event)\"\n @pointerdown=\"onPointerdown(index - 1, $event)\"\n @pointermove=\"onPointermove\"\n @pointerup=\"onPointerEnd\"\n @pointercancel=\"onPointerEnd\"\n @lostpointercapture=\"onPointerEnd\"\n >\n <span v-if=\"grip\" class=\"v-resizable-grip\" aria-hidden=\"true\" />\n </div>\n <PanelNode :node=\"node\" :index=\"index\" />\n </template>\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n .v-resizable {\n --resizable-hit: var(--vectis-control-size-resizable-hit);\n display: flex;\n }\n\n .v-resizable[data-orientation='vertical'] {\n flex-direction: column;\n }\n\n .v-resizable[data-dragging] {\n user-select: none;\n }\n\n .v-resizable-handle {\n position: relative;\n z-index: 1;\n flex: none;\n display: flex;\n align-items: center;\n justify-content: center;\n border: 0 solid var(--vectis-color-border);\n touch-action: none;\n transition:\n border-color var(--vectis-duration-fast) var(--vectis-ease-default),\n box-shadow var(--vectis-duration-fast) var(--vectis-ease-default);\n }\n\n /* The strip that catches the pointer, wider than the 1px line it is centred on. */\n .v-resizable-handle::before {\n content: '';\n position: absolute;\n }\n\n /* The content box stays empty so the line is exactly 1px: the grip overflows it, centred. */\n .v-resizable[data-orientation='horizontal'] > .v-resizable-handle {\n inline-size: 0;\n border-inline-start-width: 1px;\n cursor: col-resize;\n }\n\n .v-resizable[data-orientation='horizontal'] > .v-resizable-handle::before {\n inset-block: 0;\n inset-inline: calc(var(--resizable-hit) / -2);\n }\n\n .v-resizable[data-orientation='vertical'] > .v-resizable-handle {\n block-size: 0;\n border-block-start-width: 1px;\n cursor: row-resize;\n }\n\n .v-resizable[data-orientation='vertical'] > .v-resizable-handle::before {\n inset-inline: 0;\n inset-block: calc(var(--resizable-hit) / -2);\n }\n\n .v-resizable[data-dragging][data-orientation='horizontal'] {\n cursor: col-resize;\n }\n\n .v-resizable[data-dragging][data-orientation='vertical'] {\n cursor: row-resize;\n }\n\n .v-resizable-handle:is(:hover, [data-active]):not([aria-disabled]) {\n border-color: var(--vectis-color-accent);\n box-shadow: 0 0 0 1px var(--vectis-color-accent);\n }\n\n .v-resizable-handle:focus-visible {\n outline: var(--vectis-focus-ring-width) solid var(--vectis-focus-ring-color);\n outline-offset: var(--vectis-focus-ring-offset);\n }\n\n .v-resizable-grip {\n flex: none;\n border: 1px solid transparent;\n border-radius: var(--vectis-radius-pill);\n background: var(--vectis-color-border-strong);\n transition: background-color var(--vectis-duration-fast) var(--vectis-ease-default);\n }\n\n .v-resizable[data-orientation='horizontal'] > .v-resizable-handle > .v-resizable-grip {\n inline-size: var(--vectis-control-size-resizable-grip-thickness);\n block-size: var(--vectis-control-size-resizable-grip-length);\n }\n\n .v-resizable[data-orientation='vertical'] > .v-resizable-handle > .v-resizable-grip {\n inline-size: var(--vectis-control-size-resizable-grip-length);\n block-size: var(--vectis-control-size-resizable-grip-thickness);\n }\n\n .v-resizable-handle:is(:hover, [data-active]):not([aria-disabled]) .v-resizable-grip {\n background: var(--vectis-color-accent);\n }\n\n .v-resizable-handle[aria-disabled] {\n cursor: default;\n }\n\n .v-resizable-handle[aria-disabled] .v-resizable-grip {\n background: var(--vectis-color-border);\n }\n\n @media (forced-colors: active) {\n .v-resizable-handle:is(:hover, [data-active]):not([aria-disabled]) {\n border-color: Highlight;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .v-resizable-handle,\n .v-resizable-grip {\n transition: none;\n }\n }\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmDA,IAAM,IAAQ,GAWR,IAAQ,GAAqB,GAAA,YAAC,GAE9B,IAAO,GAaP,KAAI,EAAY,GAChB,IAAS,GAAM,GACf,IAAS,EAAwB,IAAI,GACrC,IAAa,QAAe,EAAM,gBAAgB,YAAY,GAQ9D,IAAQ,EAAa,GACrB,IAAS,QAAe,EAAM,MAAM,QAAQ,MAAS,EAAK,SAAS,CAAe,CAAC,GAEnF,KAAY,GAAa,GAAe,MAC5C,EAAK,QAAQ,MAAU,EAAK,QAAQ,IAEhC,KAAW,GAAa,MAC3B,EAAK,OAAO,MAA6B,GAAG,EAAO,SAAS,KAEzD,IAAW,QACf,EACE,EAAO,MAAM,KAAK,MAAS;GACzB,IAAM,IAAO,EAAS,GAAM,eAAe,cAAc;GACzD,OAAO,KAA+B,OAAO,KAAA,IAAY,OAAO,CAA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ACnC,iBAAe,EAAA,MAAQ,IAAK,EAAA,CAAO;GACnC,iBAAe,EAAA,MAAQ,IAAK,EAAA,CAAO;GACnC,iBAAe,EAAA,YAAY,KAAA;GAC3B,eAAa,EAAA,OAAM,WAAW,IAAK,IAAA,KAAY,KAAA;GAC/C,YAAO,MAAE,GAAU,IAAK,GAAM,CAAM;GACpC,gBAAW,MAAE,GAAc,IAAK,GAAM,CAAM;GAC/B;GACb,aAAW;GACX,iBAAe;GACf,sBAAoB;MAET,EAAA,QAAA,EAAA,GAAZ,EAAgE,QAAhE,EAAgE,KAAA,EAAA,IAAA,EAAA,CAAA,GAAA,IAAA,EAAA,KAAA,EAAA,IAAA,EAAA,GAElE,GAAyC,IAAA;GAAvB;GAAc"}
1
+ {"version":3,"file":"VResizable.vue_vue_type_script_setup_true_lang.js","names":["_useModel","VResizablePanel","_openBlock","_createElementBlock","_Fragment","_renderList","_createCommentVNode","_createVNode","VResizablePanel_default","_hoisted_1","_hoisted_2","_hoisted_3","VResizable_vue_vue_type_script_setup_true_lang_default","\"modelValue\"","\"modelModifiers\"","__emit","props","__props","model","useModel","emit","m","useMessages","baseId","useId","rootEl","ref","horizontal","computed","nodes","useSlotNodes","panels","node","nodeProp","camel","kebab","panelId","index","defaults","defaultSizes","size","sizes","entries","shallowReactive","entryAt","entry","restoreSizes","space","pixels","lengthKey","length","percentOf","px","limits","min","clamp","layoutOf","fixed","i","before","fixedTotal","sum","weights","layout","lengthInPixels","probe","root","rect","measure","rects","extents","total","extent","laidOut","sameSizes","a","b","apply","next","lim","now","isCollapsedAt","base","commit","reopenSize","remembered","sizesWithCollapsed","growth","collapse","resizeAt","primaryOf","handle","after","resizableKey","id","onKeydown","primary","primarySign","rtl","isRtl","back","forth","event","lowest","drag","shallowRef","coordinate","onPointerdown","el","onPointermove","state","delta","onPointerEnd","handles","PanelNode","cloneVNode","isDev","watchEffect","openBlock","createElementBlock","Fragment","renderList","$event","createCommentVNode","createVNode"],"sources":["../../../src/components/VResizable/VResizable.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * No native element resizes siblings, so each handle follows the APG window splitter: a focusable\n * `separator` carrying the size of its primary panel, moved with the arrow keys or dragged under\n * pointer capture. Sizes are percentages rendered as `flex-grow` weights, which needs no\n * measurement on the server.\n */\n\nimport {\n cloneVNode,\n computed,\n onMounted,\n provide,\n ref,\n shallowReactive,\n shallowRef,\n useId,\n watchEffect,\n type FunctionalComponent,\n type VNode,\n} from 'vue'\n\nimport { useSlotNodes } from '../../composables/useSlotNodes'\nimport { useMessages } from '../../i18n/state'\nimport { isRtl } from '../../utils/direction'\nimport { isDev } from '../../utils/env'\nimport { clamp } from '../../utils/number'\nimport { resizableKey, type ResizablePanelEntry } from './context'\nimport { defaultSizes, isCollapsedAt, resizeAt, type PanelLimits } from './layout'\nimport VResizablePanel from './VResizablePanel.vue'\n\n/** Which way the panels are laid out: side by side, or stacked. */\nexport type ResizableOrientation = 'horizontal' | 'vertical'\n\n/** A panel limit: a number in percent of the group, or a CSS length such as `240px`. */\nexport type ResizableLength = number | string\n\ninterface ResizableProps {\n /**\n * `horizontal` puts the panels side by side, following the direction of the text; `vertical`\n * stacks them, and the group then needs a height.\n */\n orientation?: ResizableOrientation\n /** Fixes the sizes: the handles can neither be dragged nor focused. */\n disabled?: boolean\n /** Draws a grip in the middle of every handle, which makes it easier to find. */\n grip?: boolean\n /** How far an arrow key moves a handle, in percent of the group. */\n step?: number\n}\n\nconst props = withDefaults(defineProps<ResizableProps>(), {\n orientation: 'horizontal',\n disabled: false,\n grip: false,\n step: 5,\n})\n\n/**\n * The size of each panel, in percent of the space they share, adding up to 100. Left unbound,\n * the panels start from their `defaultSize`.\n */\nconst model = defineModel<number[]>()\n\nconst emit = defineEmits<{\n /**\n * The sizes have settled: a handle was released, moved with a key, or a panel collapsed or\n * reopened. Save them here rather than on every `update:modelValue` of a drag.\n */\n change: [sizes: number[]]\n}>()\n\ndefineSlots<{\n /** The `<VResizablePanel>`s, two or more. A handle is placed between each pair. */\n default(): unknown\n}>()\n\nconst m = useMessages()\nconst baseId = useId()\nconst rootEl = ref<HTMLElement | null>(null)\nconst horizontal = computed(() => props.orientation === 'horizontal')\n\n// @ssr\n/*\n * The panels are read from the slot's VNodes, never from a registry fed at mount, which would\n * render no handle on the server. Cloning gives each panel its position and the id its handle\n * points at (the VCarousel idiom).\n */\nconst nodes = useSlotNodes()\nconst panels = computed(() => nodes.value.filter((node) => node.type === VResizablePanel))\n\nconst nodeProp = (node: VNode, camel: string, kebab: string): unknown =>\n node.props?.[camel] ?? node.props?.[kebab]\n\nconst panelId = (node: VNode, index: number) =>\n (node.props?.id as string | undefined) ?? `${baseId}-panel-${index}`\n\nconst defaults = computed(() =>\n defaultSizes(\n panels.value.map((node) => {\n const size = nodeProp(node, 'defaultSize', 'default-size')\n return size === undefined || size === null ? undefined : Number(size)\n }),\n ),\n)\n\nconst sizes = computed(() =>\n model.value?.length === panels.value.length ? model.value : defaults.value,\n)\n\nconst entries = shallowReactive(new Map<string, ResizablePanelEntry>())\nconst entryAt = (index: number) => {\n for (const entry of entries.values()) if (entry.index === index) return entry\n return undefined\n}\n\n/** Restored when a collapsed panel reopens: its size when it collapsed, by panel. */\nconst restoreSizes = new WeakMap<ResizablePanelEntry, number>()\n\n// @core\n/*\n * CSS lengths are converted at each interaction, against the space the panels share at that\n * moment. The pixels are cached so that the ARIA values can be derived reactively.\n */\nconst space = ref(0)\nconst pixels = shallowReactive(new Map<string, number>())\n\nconst lengthKey = (length: string) => `${props.orientation}:${length}`\n\nfunction percentOf(length: ResizableLength | undefined): number | undefined {\n if (length === undefined) return undefined\n if (typeof length === 'number') return length\n if (length.trim().endsWith('%')) return Number.parseFloat(length)\n const px = pixels.get(lengthKey(length))\n return px === undefined || !space.value ? undefined : (px / space.value) * 100\n}\n\nconst limits = computed<PanelLimits[]>(() =>\n panels.value.map((_, index) => {\n const entry = entryAt(index)\n const min = clamp(percentOf(entry?.minSize) ?? 0, 0, 100)\n return {\n min,\n max: clamp(percentOf(entry?.maxSize) ?? 100, min, 100),\n collapsible: !!entry?.collapsible,\n collapsedSize: clamp(percentOf(entry?.collapsedSize) ?? 0, 0, min),\n }\n }),\n)\n\n/**\n * The sizes as laid out: a collapsed panel keeps its collapsed size, and the others share the\n * rest in proportion to their weights, as `flex-grow` distributes it. `before` gives one panel\n * back the collapsed state it had before its model changed.\n */\nfunction layoutOf(before?: { index: number; collapsed: boolean }) {\n const fixed = sizes.value.map((_, i) =>\n (i === before?.index ? before.collapsed : entryAt(i)?.collapsed)\n ? limits.value[i]!.collapsedSize\n : undefined,\n )\n const fixedTotal = fixed.reduce<number>((sum, size) => sum + (size ?? 0), 0)\n const weights = sizes.value.reduce((sum, size, i) => sum + (fixed[i] === undefined ? size : 0), 0)\n return sizes.value.map(\n (size, i) => fixed[i] ?? (weights ? (size / weights) * (100 - fixedTotal) : 0),\n )\n}\n\nconst layout = computed(() => layoutOf())\n\nfunction lengthInPixels(root: HTMLElement, length: string): number {\n const probe = document.createElement('div')\n probe.style.position = 'absolute'\n probe.style.visibility = 'hidden'\n probe.style.setProperty(horizontal.value ? 'width' : 'height', length)\n root.append(probe)\n const rect = probe.getBoundingClientRect()\n probe.remove()\n return horizontal.value ? rect.width : rect.height\n}\n\n/**\n * Measures the panels as they are drawn, which accounts for CSS limits that the weights alone do\n * not show, and refreshes the converted lengths. It falls back to the computed layout when\n * nothing can be measured.\n */\nfunction measure(before?: { index: number; collapsed: boolean }): number[] {\n const root = rootEl.value\n const rects = panels.value.map((_, i) => entryAt(i)?.el?.getBoundingClientRect())\n const extents = rects.map((rect) => (rect ? (horizontal.value ? rect.width : rect.height) : 0))\n const total = extents.reduce((sum, extent) => sum + extent, 0)\n if (!root || !total || rects.some((rect) => !rect)) return layoutOf(before)\n for (const entry of entries.values())\n for (const length of [entry.minSize, entry.maxSize, entry.collapsedSize])\n if (typeof length === 'string' && !length.trim().endsWith('%'))\n pixels.set(lengthKey(length), lengthInPixels(root, length))\n space.value = total\n const laidOut = layoutOf(before)\n // Within two pixels, the difference is the 1px lines shrunk off the panels: the computed sizes\n // are kept, so the model does not fill with measurement noise. Beyond, CSS limits are at work.\n const drawn = extents.every((extent, i) => Math.abs(extent - (laidOut[i]! * total) / 100) < 2)\n return drawn ? laidOut : extents.map((extent) => (extent / total) * 100)\n}\n\nonMounted(measure)\n\nconst sameSizes = (a: readonly number[], b: readonly number[]) =>\n a.length === b.length && a.every((size, i) => Math.abs(size - b[i]!) < 0.01)\n\n/** Writes new sizes and the collapsed state they imply, remembering what collapsing panels had. */\nfunction apply(next: number[], base: readonly number[]) {\n if (!sameSizes(next, sizes.value)) model.value = next\n next.forEach((size, i) => {\n const entry = entryAt(i)\n const lim = limits.value[i]!\n if (!entry || !lim.collapsible) return\n const now = isCollapsedAt(size, lim)\n if (now && !isCollapsedAt(base[i]!, lim)) restoreSizes.set(entry, base[i]!)\n entry.setCollapsed(now)\n })\n}\n\nfunction commit(next: number[], base: readonly number[]) {\n apply(next, base)\n if (!sameSizes(next, base)) emit('change', next)\n}\n\n/**\n * The size a reopened panel returns to: the one it had when it collapsed, or its starting size,\n * within its limits.\n */\nfunction reopenSize(index: number) {\n const entry = entryAt(index)\n const lim = limits.value[index]!\n const remembered = entry && restoreSizes.get(entry)\n return clamp(remembered ?? defaults.value[index]!, lim.min, lim.max)\n}\n\n/** Collapses or reopens a panel through the handle after it, or before it for the last one. */\nfunction sizesWithCollapsed(index: number, collapse: boolean, base: readonly number[]) {\n const lim = limits.value[index]!\n const growth = (collapse ? lim.collapsedSize : reopenSize(index)) - base[index]!\n return index < base.length - 1\n ? resizeAt(base, index, growth, limits.value, 1)\n : resizeAt(base, index - 1, -growth, limits.value, 1)\n}\n\n/**\n * The panel a handle reports on and collapses: the one before it, unless only the one after it\n * can collapse, as for a sidebar on the end side.\n */\nfunction primaryOf(handle: number) {\n const before = limits.value[handle]\n const after = limits.value[handle + 1]\n return !before?.collapsible && after?.collapsible ? handle + 1 : handle\n}\n\nprovide(resizableKey, {\n get orientation() {\n return props.orientation\n },\n sizeAt: (index) => sizes.value[index] ?? 1,\n register: (id, entry) => entries.set(id, entry),\n unregister: (id) => entries.delete(id),\n // Called from the panel's pre-flush watcher: the DOM still shows the panel as it was.\n toggle(index, collapse) {\n const base = measure({ index, collapsed: !collapse })\n const lim = limits.value[index]\n if (!lim || isCollapsedAt(base[index]!, lim) === collapse) return\n commit(sizesWithCollapsed(index, collapse, base), base)\n },\n})\n\n// @keyboard\n/*\n * The arrows that run along the group move its handles, following the direction of the text.\n * Home and End give the primary panel its smallest and largest size, and Enter collapses or\n * reopens it, as the APG window splitter describes.\n */\nfunction onKeydown(handle: number, event: KeyboardEvent) {\n if (props.disabled) return\n const base = measure()\n const primary = primaryOf(handle)\n const lim = limits.value[primary]!\n // Positive when the primary panel grows, negative when it shrinks.\n const primarySign = primary === handle ? 1 : -1\n const rtl = horizontal.value && isRtl(rootEl.value)\n const back = horizontal.value ? (rtl ? 'ArrowRight' : 'ArrowLeft') : 'ArrowUp'\n const forth = horizontal.value ? (rtl ? 'ArrowLeft' : 'ArrowRight') : 'ArrowDown'\n let next: number[]\n if (event.key === back) next = resizeAt(base, handle, -props.step, limits.value, 1)\n else if (event.key === forth) next = resizeAt(base, handle, props.step, limits.value, 1)\n else if (event.key === 'Home') {\n const lowest = lim.collapsible ? lim.collapsedSize : lim.min\n next = resizeAt(base, handle, (lowest - base[primary]!) * primarySign, limits.value, 1)\n } else if (event.key === 'End')\n next = resizeAt(base, handle, (lim.max - base[primary]!) * primarySign, limits.value, 1)\n else if (event.key === 'Enter' && lim.collapsible)\n next = sizesWithCollapsed(primary, !isCollapsedAt(base[primary]!, lim), base)\n else return\n event.preventDefault()\n commit(next, base)\n}\n\ninterface Drag {\n handle: number\n pointerId: number\n origin: number\n base: number[]\n sign: number\n last: number[]\n}\n\nconst drag = shallowRef<Drag | null>(null)\n\nconst coordinate = (event: PointerEvent) => (horizontal.value ? event.clientX : event.clientY)\n\nfunction onPointerdown(handle: number, event: PointerEvent) {\n // A second pointer pressed during a drag is ignored, which leaves one finger in charge.\n if (props.disabled || event.button !== 0 || drag.value) return\n const el = event.currentTarget as HTMLElement\n const base = measure()\n if (!space.value) return\n // Prevented so that no text gets selected; the focus a press would give is given back.\n event.preventDefault()\n el.focus({ preventScroll: true })\n // @fallback\n // Synthetic pointer events have no pointer to capture; the drag then follows the handle only.\n try {\n el.setPointerCapture(event.pointerId)\n } catch {\n /* Synthetic pointers cannot be captured. */\n }\n drag.value = {\n handle,\n pointerId: event.pointerId,\n origin: coordinate(event),\n base,\n sign: horizontal.value && isRtl(rootEl.value) ? -1 : 1,\n last: base,\n }\n}\n\nfunction onPointermove(event: PointerEvent) {\n const state = drag.value\n if (!state || state.pointerId !== event.pointerId) return\n const delta = ((coordinate(event) - state.origin) / space.value) * 100 * state.sign\n state.last = resizeAt(state.base, state.handle, delta, limits.value)\n apply(state.last, state.base)\n}\n\nfunction onPointerEnd(event: PointerEvent) {\n const state = drag.value\n if (!state || state.pointerId !== event.pointerId) return\n drag.value = null\n if (!sameSizes(state.last, state.base)) emit('change', state.last)\n}\n\nconst handles = computed(() =>\n panels.value.slice(1).map((_, handle) => {\n const primary = primaryOf(handle)\n const node = panels.value[primary]!\n const lim = limits.value[primary]!\n return {\n controls: panelId(node, primary),\n label:\n (nodeProp(node, 'label', 'label') as string | undefined) ??\n m.value.resizable.panel(primary + 1),\n now: Math.round(layout.value[primary] ?? 0),\n min: Math.round(lim.collapsible ? lim.collapsedSize : lim.min),\n max: Math.round(lim.max),\n }\n }),\n)\n\n/** Renders a captured panel VNode, which `<component :is>` cannot do. */\nconst PanelNode: FunctionalComponent<{ node: VNode; index: number }> = ({ node, index }) =>\n cloneVNode(node, { index, id: panelId(node, index) })\n\n// @devwarn\nif (isDev) {\n watchEffect(() => {\n if (nodes.value.length !== panels.value.length)\n console.warn('[VResizable] Only VResizablePanel children are rendered.')\n if (model.value && model.value.length !== panels.value.length)\n console.warn(\n `[VResizable] The v-model holds ${model.value.length} sizes for ${panels.value.length} panels; the default sizes are used.`,\n )\n })\n}\n</script>\n\n<template>\n <div\n ref=\"rootEl\"\n class=\"v-resizable\"\n :data-orientation=\"orientation\"\n :data-disabled=\"disabled ? '' : undefined\"\n :data-dragging=\"drag ? '' : undefined\"\n >\n <template v-for=\"(node, index) in panels\" :key=\"node.key ?? index\">\n <!--\n A horizontal group is divided by vertical lines. `aria-orientation` is only written when\n it differs from the separator's implicit horizontal, as on VSeparator.\n -->\n <div\n v-if=\"index > 0\"\n class=\"v-resizable-handle\"\n role=\"separator\"\n :tabindex=\"disabled ? undefined : 0\"\n :aria-orientation=\"horizontal ? 'vertical' : undefined\"\n :aria-label=\"handles[index - 1]!.label\"\n :aria-controls=\"handles[index - 1]!.controls\"\n :aria-valuenow=\"handles[index - 1]!.now\"\n :aria-valuemin=\"handles[index - 1]!.min\"\n :aria-valuemax=\"handles[index - 1]!.max\"\n :aria-disabled=\"disabled || undefined\"\n :data-active=\"drag?.handle === index - 1 ? '' : undefined\"\n @keydown=\"onKeydown(index - 1, $event)\"\n @pointerdown=\"onPointerdown(index - 1, $event)\"\n @pointermove=\"onPointermove\"\n @pointerup=\"onPointerEnd\"\n @pointercancel=\"onPointerEnd\"\n @lostpointercapture=\"onPointerEnd\"\n >\n <span v-if=\"grip\" class=\"v-resizable-grip\" aria-hidden=\"true\" />\n </div>\n <PanelNode :node=\"node\" :index=\"index\" />\n </template>\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n .v-resizable {\n --resizable-hit: var(--vectis-control-size-resizable-hit);\n display: flex;\n }\n\n .v-resizable[data-orientation='vertical'] {\n flex-direction: column;\n }\n\n .v-resizable[data-dragging] {\n user-select: none;\n }\n\n .v-resizable-handle {\n position: relative;\n z-index: 1;\n flex: none;\n display: flex;\n align-items: center;\n justify-content: center;\n border: 0 solid var(--vectis-color-border);\n touch-action: none;\n transition:\n border-color var(--vectis-duration-fast) var(--vectis-ease-default),\n box-shadow var(--vectis-duration-fast) var(--vectis-ease-default);\n }\n\n /* The strip that catches the pointer, wider than the 1px line it is centred on. */\n .v-resizable-handle::before {\n content: '';\n position: absolute;\n }\n\n /* The content box stays empty so the line is exactly 1px: the grip overflows it, centred. */\n .v-resizable[data-orientation='horizontal'] > .v-resizable-handle {\n inline-size: 0;\n border-inline-start-width: 1px;\n cursor: col-resize;\n }\n\n .v-resizable[data-orientation='horizontal'] > .v-resizable-handle::before {\n inset-block: 0;\n inset-inline: calc(var(--resizable-hit) / -2);\n }\n\n .v-resizable[data-orientation='vertical'] > .v-resizable-handle {\n block-size: 0;\n border-block-start-width: 1px;\n cursor: row-resize;\n }\n\n .v-resizable[data-orientation='vertical'] > .v-resizable-handle::before {\n inset-inline: 0;\n inset-block: calc(var(--resizable-hit) / -2);\n }\n\n .v-resizable[data-dragging][data-orientation='horizontal'] {\n cursor: col-resize;\n }\n\n .v-resizable[data-dragging][data-orientation='vertical'] {\n cursor: row-resize;\n }\n\n .v-resizable-handle:is(:hover, [data-active]):not([aria-disabled]) {\n border-color: var(--vectis-color-accent);\n box-shadow: 0 0 0 1px var(--vectis-color-accent);\n }\n\n .v-resizable-handle:focus-visible {\n outline: var(--vectis-focus-ring-width) solid var(--vectis-focus-ring-color);\n outline-offset: var(--vectis-focus-ring-offset);\n }\n\n .v-resizable-grip {\n flex: none;\n border: 1px solid transparent;\n border-radius: var(--vectis-radius-pill);\n background: var(--vectis-color-border-strong);\n transition: background-color var(--vectis-duration-fast) var(--vectis-ease-default);\n }\n\n .v-resizable[data-orientation='horizontal'] > .v-resizable-handle > .v-resizable-grip {\n inline-size: var(--vectis-control-size-resizable-grip-thickness);\n block-size: var(--vectis-control-size-resizable-grip-length);\n }\n\n .v-resizable[data-orientation='vertical'] > .v-resizable-handle > .v-resizable-grip {\n inline-size: var(--vectis-control-size-resizable-grip-length);\n block-size: var(--vectis-control-size-resizable-grip-thickness);\n }\n\n .v-resizable-handle:is(:hover, [data-active]):not([aria-disabled]) .v-resizable-grip {\n background: var(--vectis-color-accent);\n }\n\n .v-resizable-handle[aria-disabled] {\n cursor: default;\n }\n\n .v-resizable-handle[aria-disabled] .v-resizable-grip {\n background: var(--vectis-color-border);\n }\n\n @media (forced-colors: active) {\n .v-resizable-handle:is(:hover, [data-active]):not([aria-disabled]) {\n border-color: Highlight;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .v-resizable-handle,\n .v-resizable-grip {\n transition: none;\n }\n }\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmDA,IAAMgB,IAAQC,GAWRC,IAAQlB,GAAqBiB,GAAA,YAAC,GAE9BG,IAAOL,GAaPM,KAAIC,EAAY,GAChBC,IAASC,GAAM,GACfC,IAASC,EAAwB,IAAI,GACrCC,IAAaC,QAAeZ,EAAM,gBAAgB,YAAY,GAQ9Da,IAAQC,EAAa,GACrBC,IAASH,QAAeC,EAAM,MAAM,QAAQ,MAASG,EAAK,SAAS/B,CAAe,CAAC,GAEnFgC,KAAY,GAAa,GAAe,MAC5CD,EAAK,QAAQE,MAAUF,EAAK,QAAQG,IAEhCC,KAAW,GAAa,MAC3BJ,EAAK,OAAO,MAA6B,GAAGT,EAAO,SAASc,KAEzDC,IAAWV,QACfW,EACER,EAAO,MAAM,KAAK,MAAS;GACzB,IAAMS,IAAOP,EAASD,GAAM,eAAe,cAAc;GACzD,OAAOQ,KAA+B,OAAO,KAAA,IAAY,OAAOA,CAAI;EACtE,CAAC,CACH,CACF,GAEMC,IAAQb,QACZV,EAAM,OAAO,WAAWa,EAAO,MAAM,SAASb,EAAM,QAAQoB,EAAS,KACvE,GAEMI,IAAUC,kBAAgB,IAAI,IAAiC,CAAC,GAChEC,KAAW,MAAkB;GACjC,KAAK,IAAMC,KAASH,EAAQ,OAAO,GAAG,IAAIG,EAAM,UAAUR,GAAO,OAAOQ;EAE1E,GAGMC,oBAAe,IAAI,QAAqC,GAOxDC,IAAQrB,EAAI,CAAC,GACbsB,IAASL,kBAAgB,IAAI,I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E5BtG,GAAAA,EAAAA,EAAA,EAAA,GAAAC,EA4BWC,GAAA,MAAAC,GA5BuB0B,EAAA,QAAhB,GAAM,OAAwBuF,EAAA,GAAAC,EAAAC,GAAA,EAAA,KAAAxF,EAAK,OAAOK,EAAA,GAAA,CAMlDA,IAAK,KADbnC,EAAA,GAAAC,EAqBM,OAAA;;GAnBJ,OAAM;GACN,MAAK;GACJ,UAAUc,EAAA,WAAW,KAAA,IAAS;GAC9B,oBAAkBU,EAAA,QAAU,aAAgB,KAAA;GAC5C,cAAYsF,EAAA,MAAQ5E,IAAK,EAAA,CAAO;GAChC,iBAAe4E,EAAA,MAAQ5E,IAAK,EAAA,CAAO;GACnC,iBAAe4E,EAAA,MAAQ5E,IAAK,EAAA,CAAO;GACnC,iBAAe4E,EAAA,MAAQ5E,IAAK,EAAA,CAAO;GACnC,iBAAe4E,EAAA,MAAQ5E,IAAK,EAAA,CAAO;GACnC,iBAAepB,EAAA,YAAY,KAAA;GAC3B,eAAauF,EAAA,OAAM,WAAWnE,IAAK,IAAA,KAAY,KAAA;GAC/C,YAAO,MAAE0D,GAAU1D,IAAK,GAAMqF,CAAM;GACpC,gBAAW,MAAEf,GAActE,IAAK,GAAMqF,CAAM;GAC/B;GACb,aAAWV;GACX,iBAAeA;GACf,sBAAoBA;EAET,GAAA,CAAA/F,EAAA,QAAZf,EAAA,GAAAC,EAAgE,QAAhEQ,EAAgE,KAAAgH,EAAA,IAAA,EAAA,CAAA,GAAA,IAAAjH,EAAA,KAAAiH,EAAA,IAAA,EAAA,GAElEpH,GAAyC2G,IAAA;GAAvB;GAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"VResizablePanel.js","names":[],"sources":["../../../src/components/VResizable/VResizablePanel.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * The group hands each panel its share of the space as a `flex-grow` weight. The panel writes its\n * own limits in CSS as well, so a length limit holds before any script runs and while the window\n * is resized.\n */\n\nimport { computed, inject, onBeforeUnmount, ref, useAttrs, useId, watch } from 'vue'\n\nimport { isDev } from '../../utils/env'\nimport { resizableKey } from './context'\nimport type { ResizableLength } from './VResizable.vue'\n\ninterface ResizablePanelProps {\n /** Which panel this is among its siblings, set by VResizable. Do not set it yourself. */\n index?: number\n /**\n * The starting size in percent, used when the group's v-model gives none. Panels without one\n * share what is left equally.\n */\n defaultSize?: number\n /** The smallest size: a number in percent, or a CSS length such as `200px` or `12rem`. */\n minSize?: ResizableLength\n /** The largest size: a number in percent, or a CSS length. */\n maxSize?: ResizableLength\n /**\n * Lets the panel collapse: dragged past the middle of its minimum, or with Enter on its\n * handle.\n */\n collapsible?: boolean\n /**\n * The size of the collapsed panel, in percent or as a CSS length such as the width of an icon\n * rail. At 0, the default, its content is hidden.\n */\n collapsedSize?: ResizableLength\n /**\n * What the panel is called. It names the handle that resizes it; the dictionary's \"Panel 2\"\n * otherwise.\n */\n label?: string\n}\n\nconst props = withDefaults(defineProps<ResizablePanelProps>(), {\n index: 0,\n defaultSize: undefined,\n minSize: 0,\n maxSize: undefined,\n collapsible: false,\n collapsedSize: 0,\n label: undefined,\n})\n\n/** Whether the panel is collapsed. It only takes effect on a `collapsible` panel. */\nconst collapsed = defineModel<boolean>('collapsed', { default: false })\n\ndefineSlots<{\n /** The panel's content. */\n default(): unknown\n}>()\n\nconst group = inject(resizableKey, null)\nconst attrs = useAttrs()\nconst id = useId()\nconst el = ref<HTMLElement | null>(null)\n\nconst isCollapsed = computed(() => props.collapsible && collapsed.value)\n\nconst cssLength = (length: ResizableLength) => (typeof length === 'number' ? `${length}%` : length)\n\n/** A collapsed size of zero leaves nothing to read, so the content is hidden, focus included. */\nconst hidesContent = computed(\n () => isCollapsed.value && Number.parseFloat(String(props.collapsedSize)) === 0,\n)\n\n// @core\n/*\n * The value the group last wrote, so the watcher below tells the group's own writes from the\n * consumer's. Only the consumer's ask the group to make room.\n */\nlet fromGroup: boolean | undefined\n\ngroup?.register(id, {\n get index() {\n return props.index\n },\n get el() {\n return el.value\n },\n get minSize() {\n return props.minSize\n },\n get maxSize() {\n return props.maxSize\n },\n get collapsible() {\n return props.collapsible\n },\n get collapsedSize() {\n return props.collapsedSize\n },\n get collapsed() {\n return isCollapsed.value\n },\n setCollapsed(value) {\n if (collapsed.value === value) return\n fromGroup = value\n collapsed.value = value\n },\n})\nonBeforeUnmount(() => group?.unregister(id))\n\nwatch(collapsed, (value) => {\n const own = value === fromGroup\n fromGroup = undefined\n if (!own && props.collapsible) group?.toggle(props.index, value)\n})\n\n// @devwarn\nif (isDev) {\n if (!group) console.warn('[VResizablePanel] Place it directly inside a VResizable.')\n watch(\n () => collapsed.value && !props.collapsible,\n (wrong) => {\n if (wrong) console.warn('[VResizablePanel] `collapsed` has no effect without `collapsible`.')\n },\n { immediate: true },\n )\n}\n\n// Every variable is set, even to its default, so that a nested group's panel never inherits\n// the limits of the panel it sits in.\nconst style = computed(() => ({\n '--resizable-panel-size': String(group?.sizeAt(props.index) ?? 1),\n '--resizable-panel-min': cssLength(props.minSize),\n '--resizable-panel-max': props.maxSize === undefined ? 'none' : cssLength(props.maxSize),\n '--resizable-panel-collapsed': cssLength(props.collapsedSize),\n}))\n</script>\n\n<template>\n <div\n :id=\"(attrs.id as string | undefined) ?? id\"\n ref=\"el\"\n class=\"v-resizable-panel\"\n :data-collapsed=\"isCollapsed ? '' : undefined\"\n :data-hidden=\"hidesContent ? '' : undefined\"\n :style=\"style\"\n >\n <slot />\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n /*\n * The basis is the size itself, padding and border included, so a padded panel still takes its\n * exact share. Growing by the same weight spreads any space left over, such as that of a\n * collapsed sibling, in proportion; the 1px handles are shrunk off the same way.\n */\n .v-resizable-panel {\n box-sizing: border-box;\n flex: var(--resizable-panel-size) var(--resizable-panel-size)\n calc(var(--resizable-panel-size) * 1%);\n overflow: auto;\n }\n\n .v-resizable[data-orientation='horizontal'] > .v-resizable-panel {\n min-inline-size: var(--resizable-panel-min);\n max-inline-size: var(--resizable-panel-max);\n }\n\n .v-resizable[data-orientation='vertical'] > .v-resizable-panel {\n min-block-size: var(--resizable-panel-min);\n max-block-size: var(--resizable-panel-max);\n }\n\n .v-resizable[data-orientation] > .v-resizable-panel[data-collapsed] {\n flex: 0 0 var(--resizable-panel-collapsed);\n min-inline-size: 0;\n max-inline-size: none;\n min-block-size: 0;\n max-block-size: none;\n }\n\n /* Removed from the layout as well, or its padding would keep the panel open. */\n .v-resizable-panel[data-hidden] {\n display: none;\n }\n}\n</style>\n"],"mappings":""}
1
+ {"version":3,"file":"VResizablePanel.js","names":["_sfc_main","VResizablePanel_vue_vue_type_script_setup_true_lang_default","VResizablePanel_default"],"sources":["../../../src/components/VResizable/VResizablePanel.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * The group hands each panel its share of the space as a `flex-grow` weight. The panel writes its\n * own limits in CSS as well, so a length limit holds before any script runs and while the window\n * is resized.\n */\n\nimport { computed, inject, onBeforeUnmount, ref, useAttrs, useId, watch } from 'vue'\n\nimport { isDev } from '../../utils/env'\nimport { resizableKey } from './context'\nimport type { ResizableLength } from './VResizable.vue'\n\ninterface ResizablePanelProps {\n /** Which panel this is among its siblings, set by VResizable. Do not set it yourself. */\n index?: number\n /**\n * The starting size in percent, used when the group's v-model gives none. Panels without one\n * share what is left equally.\n */\n defaultSize?: number\n /** The smallest size: a number in percent, or a CSS length such as `200px` or `12rem`. */\n minSize?: ResizableLength\n /** The largest size: a number in percent, or a CSS length. */\n maxSize?: ResizableLength\n /**\n * Lets the panel collapse: dragged past the middle of its minimum, or with Enter on its\n * handle.\n */\n collapsible?: boolean\n /**\n * The size of the collapsed panel, in percent or as a CSS length such as the width of an icon\n * rail. At 0, the default, its content is hidden.\n */\n collapsedSize?: ResizableLength\n /**\n * What the panel is called. It names the handle that resizes it; the dictionary's \"Panel 2\"\n * otherwise.\n */\n label?: string\n}\n\nconst props = withDefaults(defineProps<ResizablePanelProps>(), {\n index: 0,\n defaultSize: undefined,\n minSize: 0,\n maxSize: undefined,\n collapsible: false,\n collapsedSize: 0,\n label: undefined,\n})\n\n/** Whether the panel is collapsed. It only takes effect on a `collapsible` panel. */\nconst collapsed = defineModel<boolean>('collapsed', { default: false })\n\ndefineSlots<{\n /** The panel's content. */\n default(): unknown\n}>()\n\nconst group = inject(resizableKey, null)\nconst attrs = useAttrs()\nconst id = useId()\nconst el = ref<HTMLElement | null>(null)\n\nconst isCollapsed = computed(() => props.collapsible && collapsed.value)\n\nconst cssLength = (length: ResizableLength) => (typeof length === 'number' ? `${length}%` : length)\n\n/** A collapsed size of zero leaves nothing to read, so the content is hidden, focus included. */\nconst hidesContent = computed(\n () => isCollapsed.value && Number.parseFloat(String(props.collapsedSize)) === 0,\n)\n\n// @core\n/*\n * The value the group last wrote, so the watcher below tells the group's own writes from the\n * consumer's. Only the consumer's ask the group to make room.\n */\nlet fromGroup: boolean | undefined\n\ngroup?.register(id, {\n get index() {\n return props.index\n },\n get el() {\n return el.value\n },\n get minSize() {\n return props.minSize\n },\n get maxSize() {\n return props.maxSize\n },\n get collapsible() {\n return props.collapsible\n },\n get collapsedSize() {\n return props.collapsedSize\n },\n get collapsed() {\n return isCollapsed.value\n },\n setCollapsed(value) {\n if (collapsed.value === value) return\n fromGroup = value\n collapsed.value = value\n },\n})\nonBeforeUnmount(() => group?.unregister(id))\n\nwatch(collapsed, (value) => {\n const own = value === fromGroup\n fromGroup = undefined\n if (!own && props.collapsible) group?.toggle(props.index, value)\n})\n\n// @devwarn\nif (isDev) {\n if (!group) console.warn('[VResizablePanel] Place it directly inside a VResizable.')\n watch(\n () => collapsed.value && !props.collapsible,\n (wrong) => {\n if (wrong) console.warn('[VResizablePanel] `collapsed` has no effect without `collapsible`.')\n },\n { immediate: true },\n )\n}\n\n// Every variable is set, even to its default, so that a nested group's panel never inherits\n// the limits of the panel it sits in.\nconst style = computed(() => ({\n '--resizable-panel-size': String(group?.sizeAt(props.index) ?? 1),\n '--resizable-panel-min': cssLength(props.minSize),\n '--resizable-panel-max': props.maxSize === undefined ? 'none' : cssLength(props.maxSize),\n '--resizable-panel-collapsed': cssLength(props.collapsedSize),\n}))\n</script>\n\n<template>\n <div\n :id=\"(attrs.id as string | undefined) ?? id\"\n ref=\"el\"\n class=\"v-resizable-panel\"\n :data-collapsed=\"isCollapsed ? '' : undefined\"\n :data-hidden=\"hidesContent ? '' : undefined\"\n :style=\"style\"\n >\n <slot />\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n /*\n * The basis is the size itself, padding and border included, so a padded panel still takes its\n * exact share. Growing by the same weight spreads any space left over, such as that of a\n * collapsed sibling, in proportion; the 1px handles are shrunk off the same way.\n */\n .v-resizable-panel {\n box-sizing: border-box;\n flex: var(--resizable-panel-size) var(--resizable-panel-size)\n calc(var(--resizable-panel-size) * 1%);\n overflow: auto;\n }\n\n .v-resizable[data-orientation='horizontal'] > .v-resizable-panel {\n min-inline-size: var(--resizable-panel-min);\n max-inline-size: var(--resizable-panel-max);\n }\n\n .v-resizable[data-orientation='vertical'] > .v-resizable-panel {\n min-block-size: var(--resizable-panel-min);\n max-block-size: var(--resizable-panel-max);\n }\n\n .v-resizable[data-orientation] > .v-resizable-panel[data-collapsed] {\n flex: 0 0 var(--resizable-panel-collapsed);\n min-inline-size: 0;\n max-inline-size: none;\n min-block-size: 0;\n max-block-size: none;\n }\n\n /* Removed from the layout as well, or its padding would keep the panel open. */\n .v-resizable-panel[data-hidden] {\n display: none;\n }\n}\n</style>\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"VResizablePanel.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/components/VResizable/VResizablePanel.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * The group hands each panel its share of the space as a `flex-grow` weight. The panel writes its\n * own limits in CSS as well, so a length limit holds before any script runs and while the window\n * is resized.\n */\n\nimport { computed, inject, onBeforeUnmount, ref, useAttrs, useId, watch } from 'vue'\n\nimport { isDev } from '../../utils/env'\nimport { resizableKey } from './context'\nimport type { ResizableLength } from './VResizable.vue'\n\ninterface ResizablePanelProps {\n /** Which panel this is among its siblings, set by VResizable. Do not set it yourself. */\n index?: number\n /**\n * The starting size in percent, used when the group's v-model gives none. Panels without one\n * share what is left equally.\n */\n defaultSize?: number\n /** The smallest size: a number in percent, or a CSS length such as `200px` or `12rem`. */\n minSize?: ResizableLength\n /** The largest size: a number in percent, or a CSS length. */\n maxSize?: ResizableLength\n /**\n * Lets the panel collapse: dragged past the middle of its minimum, or with Enter on its\n * handle.\n */\n collapsible?: boolean\n /**\n * The size of the collapsed panel, in percent or as a CSS length such as the width of an icon\n * rail. At 0, the default, its content is hidden.\n */\n collapsedSize?: ResizableLength\n /**\n * What the panel is called. It names the handle that resizes it; the dictionary's \"Panel 2\"\n * otherwise.\n */\n label?: string\n}\n\nconst props = withDefaults(defineProps<ResizablePanelProps>(), {\n index: 0,\n defaultSize: undefined,\n minSize: 0,\n maxSize: undefined,\n collapsible: false,\n collapsedSize: 0,\n label: undefined,\n})\n\n/** Whether the panel is collapsed. It only takes effect on a `collapsible` panel. */\nconst collapsed = defineModel<boolean>('collapsed', { default: false })\n\ndefineSlots<{\n /** The panel's content. */\n default(): unknown\n}>()\n\nconst group = inject(resizableKey, null)\nconst attrs = useAttrs()\nconst id = useId()\nconst el = ref<HTMLElement | null>(null)\n\nconst isCollapsed = computed(() => props.collapsible && collapsed.value)\n\nconst cssLength = (length: ResizableLength) => (typeof length === 'number' ? `${length}%` : length)\n\n/** A collapsed size of zero leaves nothing to read, so the content is hidden, focus included. */\nconst hidesContent = computed(\n () => isCollapsed.value && Number.parseFloat(String(props.collapsedSize)) === 0,\n)\n\n// @core\n/*\n * The value the group last wrote, so the watcher below tells the group's own writes from the\n * consumer's. Only the consumer's ask the group to make room.\n */\nlet fromGroup: boolean | undefined\n\ngroup?.register(id, {\n get index() {\n return props.index\n },\n get el() {\n return el.value\n },\n get minSize() {\n return props.minSize\n },\n get maxSize() {\n return props.maxSize\n },\n get collapsible() {\n return props.collapsible\n },\n get collapsedSize() {\n return props.collapsedSize\n },\n get collapsed() {\n return isCollapsed.value\n },\n setCollapsed(value) {\n if (collapsed.value === value) return\n fromGroup = value\n collapsed.value = value\n },\n})\nonBeforeUnmount(() => group?.unregister(id))\n\nwatch(collapsed, (value) => {\n const own = value === fromGroup\n fromGroup = undefined\n if (!own && props.collapsible) group?.toggle(props.index, value)\n})\n\n// @devwarn\nif (isDev) {\n if (!group) console.warn('[VResizablePanel] Place it directly inside a VResizable.')\n watch(\n () => collapsed.value && !props.collapsible,\n (wrong) => {\n if (wrong) console.warn('[VResizablePanel] `collapsed` has no effect without `collapsible`.')\n },\n { immediate: true },\n )\n}\n\n// Every variable is set, even to its default, so that a nested group's panel never inherits\n// the limits of the panel it sits in.\nconst style = computed(() => ({\n '--resizable-panel-size': String(group?.sizeAt(props.index) ?? 1),\n '--resizable-panel-min': cssLength(props.minSize),\n '--resizable-panel-max': props.maxSize === undefined ? 'none' : cssLength(props.maxSize),\n '--resizable-panel-collapsed': cssLength(props.collapsedSize),\n}))\n</script>\n\n<template>\n <div\n :id=\"(attrs.id as string | undefined) ?? id\"\n ref=\"el\"\n class=\"v-resizable-panel\"\n :data-collapsed=\"isCollapsed ? '' : undefined\"\n :data-hidden=\"hidesContent ? '' : undefined\"\n :style=\"style\"\n >\n <slot />\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n /*\n * The basis is the size itself, padding and border included, so a padded panel still takes its\n * exact share. Growing by the same weight spreads any space left over, such as that of a\n * collapsed sibling, in proportion; the 1px handles are shrunk off the same way.\n */\n .v-resizable-panel {\n box-sizing: border-box;\n flex: var(--resizable-panel-size) var(--resizable-panel-size)\n calc(var(--resizable-panel-size) * 1%);\n overflow: auto;\n }\n\n .v-resizable[data-orientation='horizontal'] > .v-resizable-panel {\n min-inline-size: var(--resizable-panel-min);\n max-inline-size: var(--resizable-panel-max);\n }\n\n .v-resizable[data-orientation='vertical'] > .v-resizable-panel {\n min-block-size: var(--resizable-panel-min);\n max-block-size: var(--resizable-panel-max);\n }\n\n .v-resizable[data-orientation] > .v-resizable-panel[data-collapsed] {\n flex: 0 0 var(--resizable-panel-collapsed);\n min-inline-size: 0;\n max-inline-size: none;\n min-block-size: 0;\n max-block-size: none;\n }\n\n /* Removed from the layout as well, or its padding would keep the panel open. */\n .v-resizable-panel[data-hidden] {\n display: none;\n }\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0CA,IAAM,IAAQ,GAWR,IAAY,EAAoB,GAAC,WAA+B,GAOhE,IAAQ,EAAO,GAAc,IAAI,GACjC,IAAQ,EAAS,GACjB,IAAK,EAAM,GACX,IAAK,EAAwB,IAAI,GAEjC,IAAc,QAAe,EAAM,eAAe,EAAU,KAAK,GAEjE,KAAa,MAA6B,OAAO,KAAW,WAAW,GAAG,EAAO,KAAK,GAGtF,IAAe,QACb,EAAY,SAAS,OAAO,WAAW,OAAO,EAAM,aAAa,CAAC,MAAM,CAChF,GAOI;EAuCJ,AArCA,GAAO,SAAS,GAAI;GAClB,IAAI,QAAQ;IACV,OAAO,EAAM;GACf;GACA,IAAI,KAAK;IACP,OAAO,EAAG;GACZ;GACA,IAAI,UAAU;IACZ,OAAO,EAAM;GACf;GACA,IAAI,UAAU;IACZ,OAAO,EAAM;GACf;GACA,IAAI,cAAc;IAChB,OAAO,EAAM;GACf;GACA,IAAI,gBAAgB;IAClB,OAAO,EAAM;GACf;GACA,IAAI,YAAY;IACd,OAAO,EAAY;GACrB;GACA,aAAa,GAAO;IACd,EAAU,UAAU,MACxB,IAAY,GACZ,EAAU,QAAQ;GACpB;EACF,CAAC,GACD,QAAsB,GAAO,WAAW,CAAE,CAAC,GAE3C,EAAM,IAAY,MAAU;GAC1B,IAAM,IAAM,MAAU;GAEtB,AADA,IAAY,KAAA,GACR,CAAC,KAAO,EAAM,eAAa,GAAO,OAAO,EAAM,OAAO,CAAK;EACjE,CAAC,GAGG,MACG,KAAO,QAAQ,KAAK,0DAA0D,GACnF,QACQ,EAAU,SAAS,CAAC,EAAM,cAC/B,MAAU;GACT,AAAI,KAAO,QAAQ,KAAK,oEAAoE;EAC9F,GACA,EAAE,WAAW,GAAK,CACpB;EAKF,IAAM,IAAQ,SAAgB;GAC5B,0BAA0B,OAAO,GAAO,OAAO,EAAM,KAAK,KAAK,CAAC;GAChE,yBAAyB,EAAU,EAAM,OAAO;GAChD,yBAAyB,EAAM,YAAY,KAAA,IAAY,SAAS,EAAU,EAAM,OAAO;GACvF,+BAA+B,EAAU,EAAM,aAAa;EAC9D,EAAE;yBAIA,EASM,OAAA;GARH,IAAK,EAAA,CAAA,CAAK,CAAC,MAA6B,EAAA,CAAA;YACrC;GAAJ,KAAI;GACJ,OAAM;GACL,kBAAgB,EAAA,QAAW,KAAQ,KAAA;GACnC,eAAa,EAAA,QAAY,KAAQ,KAAA;GACjC,OAAK,EAAE,EAAA,KAAK;MAEb,EAAQ,EAAA,QAAA,SAAA,CAAA,GAAA,IAAA,CAAA"}
1
+ {"version":3,"file":"VResizablePanel.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_openBlock","_createElementBlock","_unref","_normalizeStyle","_renderSlot","_hoisted_1","VResizablePanel_vue_vue_type_script_setup_true_lang_default","\"collapsed\"","\"collapsedModifiers\"","props","__props","collapsed","useModel","group","inject","resizableKey","attrs","useAttrs","id","useId","el","ref","isCollapsed","computed","cssLength","length","hidesContent","fromGroup","value","onBeforeUnmount","watch","own","isDev","wrong","style","openBlock","createElementBlock","unref","normalizeStyle","renderSlot","_ctx"],"sources":["../../../src/components/VResizable/VResizablePanel.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * The group hands each panel its share of the space as a `flex-grow` weight. The panel writes its\n * own limits in CSS as well, so a length limit holds before any script runs and while the window\n * is resized.\n */\n\nimport { computed, inject, onBeforeUnmount, ref, useAttrs, useId, watch } from 'vue'\n\nimport { isDev } from '../../utils/env'\nimport { resizableKey } from './context'\nimport type { ResizableLength } from './VResizable.vue'\n\ninterface ResizablePanelProps {\n /** Which panel this is among its siblings, set by VResizable. Do not set it yourself. */\n index?: number\n /**\n * The starting size in percent, used when the group's v-model gives none. Panels without one\n * share what is left equally.\n */\n defaultSize?: number\n /** The smallest size: a number in percent, or a CSS length such as `200px` or `12rem`. */\n minSize?: ResizableLength\n /** The largest size: a number in percent, or a CSS length. */\n maxSize?: ResizableLength\n /**\n * Lets the panel collapse: dragged past the middle of its minimum, or with Enter on its\n * handle.\n */\n collapsible?: boolean\n /**\n * The size of the collapsed panel, in percent or as a CSS length such as the width of an icon\n * rail. At 0, the default, its content is hidden.\n */\n collapsedSize?: ResizableLength\n /**\n * What the panel is called. It names the handle that resizes it; the dictionary's \"Panel 2\"\n * otherwise.\n */\n label?: string\n}\n\nconst props = withDefaults(defineProps<ResizablePanelProps>(), {\n index: 0,\n defaultSize: undefined,\n minSize: 0,\n maxSize: undefined,\n collapsible: false,\n collapsedSize: 0,\n label: undefined,\n})\n\n/** Whether the panel is collapsed. It only takes effect on a `collapsible` panel. */\nconst collapsed = defineModel<boolean>('collapsed', { default: false })\n\ndefineSlots<{\n /** The panel's content. */\n default(): unknown\n}>()\n\nconst group = inject(resizableKey, null)\nconst attrs = useAttrs()\nconst id = useId()\nconst el = ref<HTMLElement | null>(null)\n\nconst isCollapsed = computed(() => props.collapsible && collapsed.value)\n\nconst cssLength = (length: ResizableLength) => (typeof length === 'number' ? `${length}%` : length)\n\n/** A collapsed size of zero leaves nothing to read, so the content is hidden, focus included. */\nconst hidesContent = computed(\n () => isCollapsed.value && Number.parseFloat(String(props.collapsedSize)) === 0,\n)\n\n// @core\n/*\n * The value the group last wrote, so the watcher below tells the group's own writes from the\n * consumer's. Only the consumer's ask the group to make room.\n */\nlet fromGroup: boolean | undefined\n\ngroup?.register(id, {\n get index() {\n return props.index\n },\n get el() {\n return el.value\n },\n get minSize() {\n return props.minSize\n },\n get maxSize() {\n return props.maxSize\n },\n get collapsible() {\n return props.collapsible\n },\n get collapsedSize() {\n return props.collapsedSize\n },\n get collapsed() {\n return isCollapsed.value\n },\n setCollapsed(value) {\n if (collapsed.value === value) return\n fromGroup = value\n collapsed.value = value\n },\n})\nonBeforeUnmount(() => group?.unregister(id))\n\nwatch(collapsed, (value) => {\n const own = value === fromGroup\n fromGroup = undefined\n if (!own && props.collapsible) group?.toggle(props.index, value)\n})\n\n// @devwarn\nif (isDev) {\n if (!group) console.warn('[VResizablePanel] Place it directly inside a VResizable.')\n watch(\n () => collapsed.value && !props.collapsible,\n (wrong) => {\n if (wrong) console.warn('[VResizablePanel] `collapsed` has no effect without `collapsible`.')\n },\n { immediate: true },\n )\n}\n\n// Every variable is set, even to its default, so that a nested group's panel never inherits\n// the limits of the panel it sits in.\nconst style = computed(() => ({\n '--resizable-panel-size': String(group?.sizeAt(props.index) ?? 1),\n '--resizable-panel-min': cssLength(props.minSize),\n '--resizable-panel-max': props.maxSize === undefined ? 'none' : cssLength(props.maxSize),\n '--resizable-panel-collapsed': cssLength(props.collapsedSize),\n}))\n</script>\n\n<template>\n <div\n :id=\"(attrs.id as string | undefined) ?? id\"\n ref=\"el\"\n class=\"v-resizable-panel\"\n :data-collapsed=\"isCollapsed ? '' : undefined\"\n :data-hidden=\"hidesContent ? '' : undefined\"\n :style=\"style\"\n >\n <slot />\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n /*\n * The basis is the size itself, padding and border included, so a padded panel still takes its\n * exact share. Growing by the same weight spreads any space left over, such as that of a\n * collapsed sibling, in proportion; the 1px handles are shrunk off the same way.\n */\n .v-resizable-panel {\n box-sizing: border-box;\n flex: var(--resizable-panel-size) var(--resizable-panel-size)\n calc(var(--resizable-panel-size) * 1%);\n overflow: auto;\n }\n\n .v-resizable[data-orientation='horizontal'] > .v-resizable-panel {\n min-inline-size: var(--resizable-panel-min);\n max-inline-size: var(--resizable-panel-max);\n }\n\n .v-resizable[data-orientation='vertical'] > .v-resizable-panel {\n min-block-size: var(--resizable-panel-min);\n max-block-size: var(--resizable-panel-max);\n }\n\n .v-resizable[data-orientation] > .v-resizable-panel[data-collapsed] {\n flex: 0 0 var(--resizable-panel-collapsed);\n min-inline-size: 0;\n max-inline-size: none;\n min-block-size: 0;\n max-block-size: none;\n }\n\n /* Removed from the layout as well, or its padding would keep the panel open. */\n .v-resizable-panel[data-hidden] {\n display: none;\n }\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0CA,IAAMU,IAAQC,GAWRC,IAAYZ,EAAoBW,GAAC,WAA+B,GAOhEG,IAAQC,EAAOC,GAAc,IAAI,GACjCC,IAAQC,EAAS,GACjBC,IAAKC,EAAM,GACXC,IAAKC,EAAwB,IAAI,GAEjCC,IAAcC,QAAed,EAAM,eAAeE,EAAU,KAAK,GAEjEa,KAAa,MAA6B,OAAOC,KAAW,WAAW,GAAGA,EAAO,KAAKA,GAGtFC,IAAeH,QACbD,EAAY,SAAS,OAAO,WAAW,OAAOb,EAAM,aAAa,CAAC,MAAM,CAChF,GAOIkB;EAuCJ,AArCAd,GAAO,SAASK,GAAI;GAClB,IAAI,QAAQ;IACV,OAAOT,EAAM;GACf;GACA,IAAI,KAAK;IACP,OAAOW,EAAG;GACZ;GACA,IAAI,UAAU;IACZ,OAAOX,EAAM;GACf;GACA,IAAI,UAAU;IACZ,OAAOA,EAAM;GACf;GACA,IAAI,cAAc;IAChB,OAAOA,EAAM;GACf;GACA,IAAI,gBAAgB;IAClB,OAAOA,EAAM;GACf;GACA,IAAI,YAAY;IACd,OAAOa,EAAY;GACrB;GACA,aAAa,GAAO;IAClB,AAAIX,EAAU,UAAUiB,MACxB,IAAYA,GACZ,EAAU,QAAQA;GACpB;EACF,CAAC,GACDC,QAAsBhB,GAAO,WAAWK,CAAE,CAAC,GAE3CY,EAAMnB,IAAY,MAAU;GAC1B,IAAMoB,IAAMH,MAAUD;GAEtB,AADA,IAAY,KAAA,GACR,CAACI,KAAOtB,EAAM,eAAaI,GAAO,OAAOJ,EAAM,OAAOmB,CAAK;EACjE,CAAC,GAGGI,MACGnB,KAAO,QAAQ,KAAK,0DAA0D,GACnFiB,QACQnB,EAAU,SAAS,CAACF,EAAM,cAC/B,MAAU;GACT,AAAIwB,KAAO,QAAQ,KAAK,oEAAoE;EAC9F,GACA,EAAE,WAAW,GAAK,CACpB;EAKF,IAAMC,IAAQX,SAAgB;GAC5B,0BAA0B,OAAOV,GAAO,OAAOJ,EAAM,KAAK,KAAK,CAAC;GAChE,yBAAyBe,EAAUf,EAAM,OAAO;GAChD,yBAAyBA,EAAM,YAAY,KAAA,IAAY,SAASe,EAAUf,EAAM,OAAO;GACvF,+BAA+Be,EAAUf,EAAM,aAAa;EAC9D,EAAE;oBAIAT,EAAA,GAAAC,EASM,OAAA;GARH,IAAKC,EAAAc,CAAA,CAAK,CAAC,MAA6Bd,EAAAgB,CAAA;GACrC,SAAA;GAAJ,KAAIE;GACJ,OAAM;GACL,kBAAgBE,EAAA,QAAW,KAAQ,KAAA;GACnC,eAAaI,EAAA,QAAY,KAAQ,KAAA;GACjC,OAAKvB,EAAE+B,EAAA,KAAK;EAEb9B,GAAAA,CAAAA,EAAQoC,EAAA,QAAA,SAAA,CAAA,GAAA,IAAAnC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","names":[],"sources":["../../../src/components/VResizable/context.ts"],"sourcesContent":["/**\n * Panels register what the group needs when it measures and moves them: their element, their\n * limits and their collapsed model. Positions come from the group, which clones each panel's\n * VNode with its `index` while rendering.\n */\n\nimport type { InjectionKey } from 'vue'\n\nimport type { ResizableOrientation, ResizableLength } from './VResizable.vue'\n\nexport interface ResizablePanelEntry {\n /** Which panel this is among its siblings. */\n readonly index: number\n readonly el: HTMLElement | null\n readonly minSize: ResizableLength\n readonly maxSize: ResizableLength | undefined\n readonly collapsible: boolean\n readonly collapsedSize: ResizableLength\n readonly collapsed: boolean\n /** Writes the panel's collapsed model on behalf of the group. */\n setCollapsed: (value: boolean) => void\n}\n\nexport interface ResizableContext {\n readonly orientation: ResizableOrientation\n /** The size of a panel in percent, used as its `flex-grow` weight. */\n sizeAt: (index: number) => number\n register: (id: string, entry: ResizablePanelEntry) => void\n unregister: (id: string) => void\n /** Collapses or reopens a panel whose collapsed model was changed from outside the group. */\n toggle: (index: number, collapsed: boolean) => void\n}\n\nexport const resizableKey: InjectionKey<ResizableContext> = Symbol('v-resizable')\n"],"mappings":";AAiCA,IAAa,IAA+C,OAAO,aAAa"}
1
+ {"version":3,"file":"context.js","names":["resizableKey"],"sources":["../../../src/components/VResizable/context.ts"],"sourcesContent":["/**\n * Panels register what the group needs when it measures and moves them: their element, their\n * limits and their collapsed model. Positions come from the group, which clones each panel's\n * VNode with its `index` while rendering.\n */\n\nimport type { InjectionKey } from 'vue'\n\nimport type { ResizableOrientation, ResizableLength } from './VResizable.vue'\n\nexport interface ResizablePanelEntry {\n /** Which panel this is among its siblings. */\n readonly index: number\n readonly el: HTMLElement | null\n readonly minSize: ResizableLength\n readonly maxSize: ResizableLength | undefined\n readonly collapsible: boolean\n readonly collapsedSize: ResizableLength\n readonly collapsed: boolean\n /** Writes the panel's collapsed model on behalf of the group. */\n setCollapsed: (value: boolean) => void\n}\n\nexport interface ResizableContext {\n readonly orientation: ResizableOrientation\n /** The size of a panel in percent, used as its `flex-grow` weight. */\n sizeAt: (index: number) => number\n register: (id: string, entry: ResizablePanelEntry) => void\n unregister: (id: string) => void\n /** Collapses or reopens a panel whose collapsed model was changed from outside the group. */\n toggle: (index: number, collapsed: boolean) => void\n}\n\nexport const resizableKey: InjectionKey<ResizableContext> = Symbol('v-resizable')\n"],"mappings":";AAiCA,IAAaA,IAA+C,OAAO,aAAa"}
@@ -1 +1 @@
1
- {"version":3,"file":"layout.js","names":[],"sources":["../../../src/components/VResizable/layout.ts"],"sourcesContent":["// @core\n/**\n * Panel sizes are percentages of the space the panels share, summing to 100. These functions are\n * pure: the component measures the DOM and converts CSS lengths before calling them.\n */\n\n/** The limits of one panel, already converted to percentages. */\nexport interface PanelLimits {\n min: number\n max: number\n collapsible: boolean\n collapsedSize: number\n}\n\n/** Below this difference two sizes are equal, which absorbs the rounding of written sizes. */\nconst EPSILON = 0.01\n\nexport const isCollapsedAt = (size: number, limits: PanelLimits) =>\n limits.collapsible && size <= limits.collapsedSize + EPSILON\n\n/** Rounds a written size so the model does not carry floating-point noise. */\nconst roundSize = (size: number) => Math.round(size * 1000) / 1000\n\n/**\n * The starting sizes: each panel's `defaultSize` where given, the rest shared equally. Sizes that\n * do not add up to 100 are scaled to.\n */\nexport function defaultSizes(defaults: (number | undefined)[]): number[] {\n const given = defaults.reduce<number>((sum, size) => sum + (size ?? 0), 0)\n const free = defaults.filter((size) => size === undefined).length\n const share = free ? Math.max(0, 100 - given) / free : 0\n const sizes = defaults.map((size) => size ?? share)\n const total = sizes.reduce((sum, size) => sum + size, 0)\n if (!total) return defaults.map(() => roundSize(100 / (defaults.length || 1)))\n return sizes.map((size) => roundSize((size / total) * 100))\n}\n\n/**\n * Moves handle `handle`, which sits between panels `handle` and `handle + 1`, so that the panel\n * before it grows by `delta` (or shrinks, when negative). The space is taken from the panels on\n * the other side, nearest first, each down to its minimum; and given to the panels on this side,\n * nearest first, each up to its maximum.\n *\n * `snap` places the collapse point of the two neighbours between their collapsed size and their\n * minimum: 0.5 for a pointer, which must travel half that distance, 1 for the keyboard, which\n * collapses or reopens on the first press.\n */\nexport function resizeAt(\n base: readonly number[],\n handle: number,\n delta: number,\n limits: readonly PanelLimits[],\n snap = 0.5,\n): number[] {\n if (Math.abs(delta) < EPSILON) return [...base]\n const growing = delta > 0\n const growFirst = growing ? handle : handle + 1\n const growStep = growing ? -1 : 1\n const shrinkFirst = growing ? handle + 1 : handle\n const shrinkStep = growing ? 1 : -1\n const inRange = (i: number) => i >= 0 && i < base.length\n\n let want = Math.abs(delta)\n\n // A collapsed neighbour stays shut until the pull passes its collapse point, then opens at\n // its minimum at once: a panel narrower than its minimum is a state no rule allows.\n const opener = limits[growFirst]!\n const opening = isCollapsedAt(base[growFirst]!, opener)\n const openGap = Math.max(0, opener.min - opener.collapsedSize)\n if (opening) {\n if (want < openGap * (1 - snap) - EPSILON) return [...base]\n want = Math.max(want, openGap)\n }\n\n // A collapsed panel further away is not reopened by a drag that only passes by.\n let room = 0\n for (let i = growFirst; inRange(i); i += growStep) {\n if (i !== growFirst && isCollapsedAt(base[i]!, limits[i]!)) continue\n room += Math.max(0, limits[i]!.max - base[i]!)\n }\n want = Math.min(want, room)\n\n const next = [...base]\n let taken = 0\n for (let i = shrinkFirst; inRange(i) && want - taken > EPSILON; i += shrinkStep) {\n const lim = limits[i]!\n const size = base[i]!\n if (isCollapsedAt(size, lim)) continue\n let target = size - (want - taken)\n if (target < lim.min) {\n const collapsePoint = lim.collapsedSize + (lim.min - lim.collapsedSize) * snap\n const canCollapse =\n lim.collapsible &&\n i === shrinkFirst &&\n target < collapsePoint - EPSILON &&\n taken + size - lim.collapsedSize <= room + EPSILON\n target = canCollapse ? lim.collapsedSize : lim.min\n }\n target = Math.min(target, size)\n taken += size - target\n next[i] = target\n }\n\n if (opening && taken < openGap - EPSILON) return [...base]\n\n let left = taken\n for (let i = growFirst; inRange(i) && left > EPSILON; i += growStep) {\n const lim = limits[i]!\n if (i !== growFirst && isCollapsedAt(base[i]!, lim)) continue\n const size = next[i]!\n const target = Math.min(lim.max, size + left)\n left -= target - size\n next[i] = target\n }\n if (left > EPSILON) return [...base]\n\n return next.map(roundSize)\n}\n"],"mappings":";AAeA,IAAM,IAAU,KAEH,KAAiB,GAAc,MAC1C,EAAO,eAAe,KAAQ,EAAO,gBAAgB,GAGjD,KAAa,MAAiB,KAAK,MAAM,IAAO,GAAI,IAAI;AAM9D,SAAgB,EAAa,GAA4C;CACvE,IAAM,IAAQ,EAAS,QAAgB,GAAK,MAAS,KAAO,KAAQ,IAAI,CAAC,GACnE,IAAO,EAAS,QAAQ,MAAS,MAAS,KAAA,CAAS,CAAC,CAAC,QACrD,IAAQ,IAAO,KAAK,IAAI,GAAG,MAAM,CAAK,IAAI,IAAO,GACjD,IAAQ,EAAS,KAAK,MAAS,KAAQ,CAAK,GA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AI,KAAK;GACpB,IAAM,IAAgB,EAAI,iBAAiB,EAAI,MAAM,EAAI,iBAAiB;GAM1E,IAJE,EAAI,eACJ,MAAM,KACN,IAAS,IAAgB,KACzB,IAAQ,IAAO,EAAI,iBAAiB,IAAO,IACtB,EAAI,gBAAgB,EAAI;EACjD;EAGA,AAFA,IAAS,KAAK,IAAI,GAAQ,CAAI,GAC9B,KAAS,IAAO,GAChB,EAAK,KAAK;CACZ;CAEA,IAAI,KAAW,IAAQ,IAAU,GAAS,OAAO,CAAC,GAAG,CAAI;CAEzD,IAAI,IAAO;CACX,KAAK,IAAI,IAAI,GAAW,EAAQ,CAAC,KAAK,IAAO,GAAS,KAAK,GAAU;EACnE,IAAM,IAAM,EAAO;EACnB,IAAI,MAAM,KAAa,EAAc,EAAK,IAAK,CAAG,GAAG;EACrD,IAAM,IAAO,EAAK,IACZ,IAAS,KAAK,IAAI,EAAI,KAAK,IAAO,CAAI;EAE5C,AADA,KAAQ,IAAS,GACjB,EAAK,KAAK;CACZ;CAGA,OAFI,IAAO,IAAgB,CAAC,GAAG,CAAI,IAE5B,EAAK,IAAI,CAAS;AAC3B"}
1
+ {"version":3,"file":"layout.js","names":["EPSILON","isCollapsedAt","limits","size","roundSize","defaultSizes","given","defaults","sum","free","share","sizes","total","resizeAt","delta","base","growing","growFirst","handle","growStep","shrinkFirst","shrinkStep","inRange","i","want","opener","opening","openGap","snap","room","next","taken","lim","target","collapsePoint","left"],"sources":["../../../src/components/VResizable/layout.ts"],"sourcesContent":["// @core\n/**\n * Panel sizes are percentages of the space the panels share, summing to 100. These functions are\n * pure: the component measures the DOM and converts CSS lengths before calling them.\n */\n\n/** The limits of one panel, already converted to percentages. */\nexport interface PanelLimits {\n min: number\n max: number\n collapsible: boolean\n collapsedSize: number\n}\n\n/** Below this difference two sizes are equal, which absorbs the rounding of written sizes. */\nconst EPSILON = 0.01\n\nexport const isCollapsedAt = (size: number, limits: PanelLimits) =>\n limits.collapsible && size <= limits.collapsedSize + EPSILON\n\n/** Rounds a written size so the model does not carry floating-point noise. */\nconst roundSize = (size: number) => Math.round(size * 1000) / 1000\n\n/**\n * The starting sizes: each panel's `defaultSize` where given, the rest shared equally. Sizes that\n * do not add up to 100 are scaled to.\n */\nexport function defaultSizes(defaults: (number | undefined)[]): number[] {\n const given = defaults.reduce<number>((sum, size) => sum + (size ?? 0), 0)\n const free = defaults.filter((size) => size === undefined).length\n const share = free ? Math.max(0, 100 - given) / free : 0\n const sizes = defaults.map((size) => size ?? share)\n const total = sizes.reduce((sum, size) => sum + size, 0)\n if (!total) return defaults.map(() => roundSize(100 / (defaults.length || 1)))\n return sizes.map((size) => roundSize((size / total) * 100))\n}\n\n/**\n * Moves handle `handle`, which sits between panels `handle` and `handle + 1`, so that the panel\n * before it grows by `delta` (or shrinks, when negative). The space is taken from the panels on\n * the other side, nearest first, each down to its minimum; and given to the panels on this side,\n * nearest first, each up to its maximum.\n *\n * `snap` places the collapse point of the two neighbours between their collapsed size and their\n * minimum: 0.5 for a pointer, which must travel half that distance, 1 for the keyboard, which\n * collapses or reopens on the first press.\n */\nexport function resizeAt(\n base: readonly number[],\n handle: number,\n delta: number,\n limits: readonly PanelLimits[],\n snap = 0.5,\n): number[] {\n if (Math.abs(delta) < EPSILON) return [...base]\n const growing = delta > 0\n const growFirst = growing ? handle : handle + 1\n const growStep = growing ? -1 : 1\n const shrinkFirst = growing ? handle + 1 : handle\n const shrinkStep = growing ? 1 : -1\n const inRange = (i: number) => i >= 0 && i < base.length\n\n let want = Math.abs(delta)\n\n // A collapsed neighbour stays shut until the pull passes its collapse point, then opens at\n // its minimum at once: a panel narrower than its minimum is a state no rule allows.\n const opener = limits[growFirst]!\n const opening = isCollapsedAt(base[growFirst]!, opener)\n const openGap = Math.max(0, opener.min - opener.collapsedSize)\n if (opening) {\n if (want < openGap * (1 - snap) - EPSILON) return [...base]\n want = Math.max(want, openGap)\n }\n\n // A collapsed panel further away is not reopened by a drag that only passes by.\n let room = 0\n for (let i = growFirst; inRange(i); i += growStep) {\n if (i !== growFirst && isCollapsedAt(base[i]!, limits[i]!)) continue\n room += Math.max(0, limits[i]!.max - base[i]!)\n }\n want = Math.min(want, room)\n\n const next = [...base]\n let taken = 0\n for (let i = shrinkFirst; inRange(i) && want - taken > EPSILON; i += shrinkStep) {\n const lim = limits[i]!\n const size = base[i]!\n if (isCollapsedAt(size, lim)) continue\n let target = size - (want - taken)\n if (target < lim.min) {\n const collapsePoint = lim.collapsedSize + (lim.min - lim.collapsedSize) * snap\n const canCollapse =\n lim.collapsible &&\n i === shrinkFirst &&\n target < collapsePoint - EPSILON &&\n taken + size - lim.collapsedSize <= room + EPSILON\n target = canCollapse ? lim.collapsedSize : lim.min\n }\n target = Math.min(target, size)\n taken += size - target\n next[i] = target\n }\n\n if (opening && taken < openGap - EPSILON) return [...base]\n\n let left = taken\n for (let i = growFirst; inRange(i) && left > EPSILON; i += growStep) {\n const lim = limits[i]!\n if (i !== growFirst && isCollapsedAt(base[i]!, lim)) continue\n const size = next[i]!\n const target = Math.min(lim.max, size + left)\n left -= target - size\n next[i] = target\n }\n if (left > EPSILON) return [...base]\n\n return next.map(roundSize)\n}\n"],"mappings":";AAeA,IAAMA,IAAU,KAEHC,KAAiB,GAAc,MAC1CC,EAAO,eAAeC,KAAQD,EAAO,gBAAgBF,GAGjDI,KAAa,MAAiB,KAAK,MAAMD,IAAO,GAAI,IAAI;AAM9D,SAAgBE,EAAa,GAA4C;CACvE,IAAMC,IAAQC,EAAS,QAAgB,GAAK,MAASC,KAAOL,KAAQ,IAAI,CAAC,GACnEM,IAAOF,EAAS,QAAQ,MAASJ,MAAS,KAAA,CAAS,CAAC,CAAC,QACrDO,IAAQD,IAAO,KAAK,IAAI,GAAG,MAAMH,CAAK,IAAIG,IAAO,GACjDE,IAAQJ,EAAS,KAAK,MAASJ,KAAQO,CAAK,GAC5CE,IAAQD,EAAM,QAAQ,GAAK,MAASH,IAAML,GAAM,CAAC;CAEvD,OADKS,IACED,EAAM,KAAK,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IC,IAAS9B,KAAQqB,IAAOO;EAC5B,IAAIE,IAASD,EAAI,KAAK;GACpB,IAAME,IAAgBF,EAAI,iBAAiBA,EAAI,MAAMA,EAAI,iBAAiBJ;GAM1E,IAJEI,EAAI,eACJT,MAAMH,KACNa,IAASC,IAAgBlC,KACzB+B,IAAQ5B,IAAO6B,EAAI,iBAAiBH,IAAO7B,IACtBgC,EAAI,gBAAgBA,EAAI;EACjD;EAGA,AAFA,IAAS,KAAK,IAAIC,GAAQ9B,CAAI,GAC9B,KAASA,IAAO8B,GAChB,EAAKV,KAAKU;CACZ;CAEA,IAAIP,KAAWK,IAAQJ,IAAU3B,GAAS,OAAO,CAAC,GAAGe,CAAI;CAEzD,IAAIoB,IAAOJ;CACX,KAAK,IAAIR,IAAIN,GAAWK,EAAQC,CAAC,KAAKY,IAAOnC,GAAS,KAAKmB,GAAU;EACnE,IAAMa,IAAM9B,EAAOqB;EACnB,IAAIA,MAAMN,KAAahB,EAAcc,EAAKQ,IAAKS,CAAG,GAAG;EACrD,IAAM7B,IAAO2B,EAAKP,IACZU,IAAS,KAAK,IAAID,EAAI,KAAK7B,IAAOgC,CAAI;EAE5C,AADA,KAAQF,IAAS9B,GACjB,EAAKoB,KAAKU;CACZ;CAGA,OAFIE,IAAOnC,IAAgB,CAAC,GAAGe,CAAI,IAE5Be,EAAK,IAAI1B,CAAS;AAC3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"VSelect.js","names":[],"sources":["../../../src/components/VSelect/VSelect.vue"],"sourcesContent":["<script setup lang=\"ts\">\n// @keyboard @a11y @core\n/**\n * A select-only combobox: a native button keeps DOM focus and moves aria-activedescendant through\n * the options, since a native `<select>` cannot draw its list with the design system on every\n * engine. A hidden native `<select>` carries the value into forms, with its constraint\n * validation, autofill and reset.\n */\n\nimport { computed, inject, onBeforeUnmount, onMounted, ref, useId, watch } from 'vue'\n\nimport { expand_more as expandMoreIcon } from '../VIcon/icons/expand_more'\nimport type { IconSource } from '../VIcon/types'\nimport type { FieldLabelPosition } from '../VField/VField.vue'\nimport VInput from '../VInput/VInput.vue'\nimport { inputGroupKey } from '../VInput/context'\nimport VListboxChevron from '../VListbox/VListboxChevron.vue'\nimport VListboxPanel from '../VListbox/VListboxPanel.vue'\nimport VListboxValues from '../VListbox/VListboxValues.vue'\nimport VSpinner from '../VSpinner/VSpinner.vue'\n\nimport type {\n ItemValue,\n ListboxGroup,\n ListboxItem,\n ListboxChipSlotProps,\n ListboxOption,\n ListboxOptionSlotProps,\n ListboxOverflowSlotProps,\n ListboxSeparator,\n} from '../../types'\nimport { toggleValue } from '../../utils/array'\nimport { partitionAttrs } from '../../utils/attrs'\nimport { chipScaleFor } from '../../utils/chip'\nimport { createNormalizedCache, normalizeText } from '../../utils/text'\n\nimport { canClear } from '../../composables/useClearable'\nimport { useControlShape } from '../../composables/useControlShape'\nimport { useFocusoutDismiss } from '../../composables/useFocusoutDismiss'\nimport { iconStartListener } from '../../composables/useIconClickHandlers'\nimport { selectionOf, useListbox } from '../../composables/useListbox'\nimport { useRootAttrs } from '../../composables/useRootAttrs'\nimport { useTimer } from '../../composables/useTimer'\nimport { useMessages } from '../../i18n/state'\n\n/** One thing that can be chosen. */\nexport type SelectOption = ListboxOption\n\n/** A named block of options, the equivalent of a native `<optgroup>`. */\nexport type SelectGroup = ListboxGroup\n\n/** A rule drawn between two blocks of options, purely decorative. */\nexport type SelectSeparator = ListboxSeparator\n\n/** Anything the list may hold: an option, a named block, or a separator. */\nexport type SelectItem = ListboxItem\n\n/** Where the list opens relative to the field. */\nexport type SelectPlacement =\n 'bottom' | 'bottom-start' | 'bottom-end' | 'top' | 'top-start' | 'top-end'\n\n/** The height of the field: 32, 40 or 48 pixels. */\nexport type SelectSize = 'sm' | 'md' | 'lg'\n\n/**\n * How the chosen values are shown in a multiple field: one chip each, or their labels\n * joined by commas.\n */\nexport type SelectDisplay = 'chip' | 'text'\n\n/** What the `#option` slot receives. */\nexport type SelectOptionSlotProps = ListboxOptionSlotProps\n\n/** What the `#chip` slot receives. */\nexport type SelectChipSlotProps = ListboxChipSlotProps\n\n/** What the `#overflow` slot receives. */\nexport type SelectOverflowSlotProps = ListboxOverflowSlotProps\n\ninterface SelectProps {\n /**\n * What the list offers. An entry may be an option, a named block of options, or a\n * separator; a plain list of options remains perfectly valid.\n */\n options: SelectItem[]\n /**\n * Allows several values to be chosen, which makes the value a list and shows what has been\n * chosen inside the field, as chips or as text depending on `display`. The list then stays\n * open while options are toggled.\n */\n multiple?: boolean\n /**\n * How the chosen values are shown when several can be chosen: one dismissible chip each, or\n * their labels joined by commas on a single line, cut short with an ellipsis when they run\n * out of room.\n */\n display?: SelectDisplay\n /**\n * How many chosen values to show while the field is not focused, before the rest are summed\n * up as \"+X\". Left out, or set to 0, every value is shown.\n */\n max?: number\n /**\n * Rephrases the \"+X\" standing for the values beyond `max`, \"+5 products\" for instance.\n * It receives the number of values being hidden.\n */\n overflowText?: (count: number) => string\n /** The label above the field, tied to it so that clicking it focuses the field. */\n label?: string\n /**\n * A line of help under the field. It is tied to the field for assistive technology,\n * so it is read out along with the label.\n */\n hint?: string\n /**\n * A message saying what is wrong with the value, shown in place of the hint so that the field\n * does not grow. It marks the field invalid, is read along with it, and is announced when it\n * appears or changes.\n */\n error?: string\n /**\n * Marks the field as required: an asterisk follows the label, the combobox is announced as\n * required, and the hidden `<select>` a form reads is `required`.\n */\n required?: boolean\n /** Hides the label visually. It still names the field for assistive technology. */\n hideLabel?: boolean\n /**\n * Where the label sits: above the field (`top`, the default), or at its start, in a column of\n * its own, moving back above when there is not room for both.\n */\n labelPosition?: FieldLabelPosition\n /** The height of the field: 32, 40 or 48 pixels. */\n size?: SelectSize\n /** Takes 4px off the height, as everywhere else in the design system. */\n compact?: boolean\n /** What the field says while nothing is chosen. */\n placeholder?: string\n /** Makes the field unusable, greyed out through the colour tokens. Its value is not submitted. */\n disabled?: boolean\n /**\n * Shows what has been chosen without letting it be changed: the field stays focusable and its\n * value is submitted, but the list never opens, the chips lose their crosses and no clear\n * cross is offered.\n */\n readonly?: boolean\n /** Marks the field as invalid, for a rule of your own. */\n invalid?: boolean\n /**\n * An icon inside the field, at the start, before the chips when several values can\n * be chosen. It is decorative by default and becomes a real button as soon as a\n * `@click:icon-start` listener is attached, in which case it needs `iconStartLabel`.\n */\n iconStart?: IconSource\n /** What the start icon does, in words, once it is clickable. */\n iconStartLabel?: string\n /**\n * The chevron at the end of the field, which turns as the list opens: an icon name, or an\n * explicit render.\n */\n expandIcon?: IconSource\n /**\n * Says that the options are being loaded: a spinner takes the chevron's place. The list still\n * opens.\n */\n loading?: boolean\n /** What the spinner is announced as. It falls back to the design system dictionary. */\n loadingText?: string\n /** Offers a cross that empties the selection. */\n clearable?: boolean\n /** What that cross does, in words. It falls back to the design system dictionary. */\n clearLabel?: string\n /** Where the list opens relative to the field. */\n placement?: SelectPlacement\n}\n\nconst props = withDefaults(defineProps<SelectProps>(), {\n multiple: false,\n display: 'chip',\n max: undefined,\n overflowText: undefined,\n label: undefined,\n hint: undefined,\n error: undefined,\n required: false,\n hideLabel: false,\n labelPosition: 'top',\n size: 'md',\n compact: false,\n placeholder: undefined,\n disabled: false,\n readonly: false,\n invalid: false,\n iconStart: undefined,\n iconStartLabel: undefined,\n expandIcon: () => expandMoreIcon,\n loading: false,\n loadingText: undefined,\n clearable: false,\n clearLabel: undefined,\n placement: 'bottom-start',\n})\n\nconst m = useMessages()\nconst resolvedClearLabel = computed(() => props.clearLabel ?? m.value.select.clear)\n\nconst emit = defineEmits<{\n /** The clear cross emptied the selection. */\n clear: []\n /** The start icon was clicked. Attaching this listener is what makes it a button. */\n 'click:icon-start': [event: MouseEvent]\n}>()\n\ndefineSlots<{\n /**\n * Content at the start of the field, rendered after the chips standing for the chosen\n * values rather than in their place.\n */\n start?(): unknown\n /**\n * Controls of your own inside the field, placed before the ones the field owns: the clear\n * cross and the chevron.\n */\n 'value-end'?(): unknown\n /** What a row of the list shows, in place of the plain label: a subtitle, an avatar, a badge. */\n option?(props: SelectOptionSlotProps): unknown\n /** Replaces the chip standing for one chosen value. */\n chip?(props: SelectChipSlotProps): unknown\n /** Replaces the \"+X\" standing for the values beyond `max`. */\n overflow?(props: SelectOverflowSlotProps): unknown\n}>()\n\nconst group = inject(inputGroupKey, null)\nconst {\n size: resolvedSize,\n compact: resolvedCompact,\n disabled: resolvedDisabled,\n} = useControlShape(props, group)\n\nconst chipScale = computed(() => chipScaleFor(resolvedSize.value, resolvedCompact.value))\n\n/** The chosen option's `value`, `''` while nothing is chosen, or the list of them when `multiple` is set. */\nconst model = defineModel<ItemValue | ItemValue[]>({ default: '' })\n\n// `class` and `style` stay on the wrapper; the form attributes go to the hidden `<select>`, which\n// is what a form reads; everything else goes down to the button, the element assistive\n// technology treats as the combobox.\ndefineOptions({ inheritAttrs: false })\nconst { rootClass, rootStyle, forwardedAttrs } = useRootAttrs()\n\nconst NATIVE_ONLY = ['name', 'form', 'autocomplete']\nconst split = computed(() => partitionAttrs(forwardedAttrs.value, NATIVE_ONLY))\nconst nativeAttrs = computed(() => split.value.picked)\n\n// Declared as this component's own event, `click:icon-start` is out of `$attrs`, so the\n// listener is relayed to the field by hand; and only when the consumer wrote one.\nconst iconStartClick = iconStartListener((event) => emit('click:icon-start', event))\nconst fieldAttrs = computed(() => ({ ...split.value.rest, ...iconStartClick }))\n\nconst rootEl = ref<HTMLElement | null>(null)\nconst triggerEl = ref<HTMLButtonElement | null>(null)\nconst nativeEl = ref<HTMLSelectElement | null>(null)\nconst panelRef = ref<InstanceType<typeof VListboxPanel> | null>(null)\nconst optionsId = useId()\n\nconst open = ref(false)\nconst focused = ref(false)\n\nconst selectedValues = computed(() => selectionOf(model.value, props.multiple))\n\nconst {\n allOptions,\n visible,\n optionOf,\n labelOf,\n remember,\n activeIndex,\n optionId,\n highlightFirst,\n highlightLast,\n highlightSelected,\n move,\n page,\n hover,\n blocks,\n measureRow,\n} = useListbox({\n items: () => props.options,\n selected: () => selectedValues.value,\n open: () => open.value,\n id: optionsId,\n panelEl: () => panelRef.value?.el ?? null,\n virtual: () => false,\n size: () => resolvedSize.value,\n compact: () => resolvedCompact.value,\n})\n\n// @a11y\n// What the button says, which assistive technology reads as the combobox's value: the chosen\n// label, or every chosen label when the chips beside it show them.\nconst valueText = computed(() => selectedValues.value.map(labelOf).join(', '))\n\nconst textDisplay = computed(() => props.multiple && props.display === 'text')\n\n// Folded, the values beyond `max` are summed up; under the focus, every value is there to be\n// seen and taken back.\nconst collapsed = computed(() => props.multiple && !focused.value && !open.value)\n\nconst clearVisible = computed(() =>\n canClear(props, resolvedDisabled.value, selectedValues.value.length > 0),\n)\n\n/** Whether the hidden `<select>` failed validation since the value last changed. */\nconst nativeInvalid = ref(false)\n\nfunction openPanel() {\n if (resolvedDisabled.value || props.readonly || open.value) return\n open.value = true\n highlightSelected()\n}\n\nfunction closePanel() {\n if (!open.value) return\n open.value = false\n activeIndex.value = -1\n}\n\nfunction togglePanel() {\n if (open.value) closePanel()\n else openPanel()\n}\n\nconst onFocusout = useFocusoutDismiss(rootEl, () => {\n focused.value = false\n closePanel()\n})\n\nfunction choose(option: SelectOption) {\n if (option.disabled || props.readonly || resolvedDisabled.value) return\n remember(option)\n if (props.multiple) {\n model.value = toggleValue(selectedValues.value, option.value)\n } else {\n // Choosing the option already chosen (Tab without moving, for one) changes nothing.\n if (model.value !== option.value) model.value = option.value\n closePanel()\n }\n}\n\nfunction chooseActive() {\n const option = visible.value[activeIndex.value]\n if (option) choose(option)\n}\n\nfunction removeValue(value: ItemValue) {\n if (!props.multiple || props.readonly || resolvedDisabled.value) return\n model.value = selectedValues.value.filter((v) => v !== value)\n // The cross disappears along with its chip, so the focus would fall back to the page.\n triggerEl.value?.focus()\n}\n\n/** The cross was pressed. It disappears with the selection, so the focus goes back to the button. */\nfunction onClear() {\n model.value = props.multiple ? [] : ''\n triggerEl.value?.focus()\n emit('clear')\n}\n\nconst normalizedOf = createNormalizedCache<SelectOption>()\nlet typed = ''\nconst typeTimer = useTimer()\n\n// @keyboard\n/*\n * Typing a label's first letters highlights it, as a native list does: the letters typed within\n * half a second add up to a prefix, and the same letter repeated cycles through the options it\n * starts.\n */\nfunction typeahead(key: string) {\n typed += normalizeText(key)\n typeTimer.start(() => (typed = ''), 500)\n const list = visible.value\n if (list.length === 0) return\n const cycling = [...typed].every((char) => char === typed[0])\n const needle = cycling ? typed[0]! : typed\n // A new prefix may match the highlighted option itself; a cycle moves on from it.\n const from = activeIndex.value + (typed.length === 1 || cycling ? 1 : 0)\n for (let step = 0; step < list.length; step++) {\n const index = (Math.max(from, 0) + step) % list.length\n const option = list[index]!\n if (!option.disabled && normalizedOf(option, option.label).startsWith(needle)) {\n activeIndex.value = index\n return\n }\n }\n}\n\nconst printable = (event: KeyboardEvent) =>\n event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey\n\n// @keyboard\n// The keys of the select-only combobox pattern. Enter and Space are consumed on the closed button\n// too, so the click they would synthesise does not toggle the list a second time.\nfunction onKeydown(event: KeyboardEvent) {\n if (!open.value) {\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowUp':\n case 'Enter':\n case ' ':\n event.preventDefault()\n openPanel()\n return\n case 'Home':\n event.preventDefault()\n openPanel()\n if (open.value) highlightFirst()\n return\n case 'End':\n event.preventDefault()\n openPanel()\n if (open.value) highlightLast()\n return\n }\n if (printable(event)) {\n openPanel()\n if (open.value) typeahead(event.key)\n }\n return\n }\n\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault()\n move(1)\n break\n case 'ArrowUp':\n event.preventDefault()\n if (event.altKey) {\n chooseActive()\n closePanel()\n } else move(-1)\n break\n case 'Home':\n event.preventDefault()\n highlightFirst()\n break\n case 'End':\n event.preventDefault()\n highlightLast()\n break\n case 'PageDown':\n event.preventDefault()\n page(10)\n break\n case 'PageUp':\n event.preventDefault()\n page(-10)\n break\n case ' ':\n event.preventDefault()\n // While letters are being typed, a space belongs to the prefix: \"New York\".\n if (typed) typeahead(' ')\n else chooseActive()\n break\n case 'Enter':\n event.preventDefault()\n chooseActive()\n break\n case 'Escape':\n // Consumed only when it closes the list, so a surrounding VDialog stays open.\n event.preventDefault()\n closePanel()\n break\n case 'Tab':\n // Leaving a single list takes the highlighted option, as the pattern prescribes.\n if (!props.multiple) chooseActive()\n closePanel()\n break\n default:\n if (printable(event)) typeahead(event.key)\n }\n}\n\nconst interactive = 'a, button, input, select, textarea, [tabindex]'\n\n// @core\n/*\n * The rest of the field is not focusable, so pressing it would hand the focus to the page: the\n * root's `focusout` then closes the list, and the click that follows reopens it.\n */\nfunction onControlMousedown(event: MouseEvent) {\n const target = event.target as Element\n if (target.closest('.v-input-field') && !target.closest(interactive)) event.preventDefault()\n}\n\n/**\n * A click anywhere in the box of the field toggles the list, as one on the button does. The\n * field's own controls keep their clicks, and the label's reaches the button by itself.\n */\nfunction onControlClick(event: MouseEvent) {\n const target = event.target as Element\n if (resolvedDisabled.value || !target.closest('.v-input-field') || target.closest(interactive))\n return\n triggerEl.value?.focus()\n togglePanel()\n}\n\n/*\n * The hidden `<select>` is written by hand rather than through `selected` bindings: a form reset\n * changes it behind the virtual DOM's back, which would then consider unchanged options already\n * in the right state.\n */\nfunction syncNative() {\n const el = nativeEl.value\n if (!el) return\n for (const option of el.options) {\n option.selected = option.value !== '' && wantedValues.value.has(option.value)\n }\n if (!props.multiple && selectedValues.value.length === 0) el.value = ''\n}\n\nconst wantedValues = computed(() => new Set(selectedValues.value.map(String)))\n\nwatch([selectedValues, allOptions], syncNative, { flush: 'post' })\n\n// A choice that satisfies the constraint clears the error the last submission raised; one that\n// does not raises it again, `checkValidity` firing `invalid`.\nwatch(\n selectedValues,\n () => {\n if (nativeInvalid.value) nativeInvalid.value = !nativeEl.value?.checkValidity()\n },\n { flush: 'post' },\n)\n\n/** Autofill writes the hidden `<select>`; the strings it holds are read back as option values. */\nfunction onNativeChange() {\n const el = nativeEl.value\n if (!el) return\n const values = [...el.selectedOptions]\n .map((native) => allOptions.value.find((option) => String(option.value) === native.value))\n .filter((option): option is SelectOption => option !== undefined)\n .map((option) => option.value)\n model.value = props.multiple ? values : (values[0] ?? '')\n}\n\n// @core\n// A form reset restores the value the field was created with. The browser resets the hidden\n// `<select>` after the event, so it is rewritten on the next task.\nlet initial: ItemValue | ItemValue[] = ''\nlet formEl: HTMLFormElement | null = null\n\nfunction onFormReset() {\n model.value = Array.isArray(initial) ? [...initial] : initial\n nativeInvalid.value = false\n setTimeout(syncNative)\n}\n\nonMounted(() => {\n initial = Array.isArray(model.value) ? [...model.value] : model.value\n syncNative()\n formEl = nativeEl.value?.form ?? null\n formEl?.addEventListener('reset', onFormReset)\n})\n\nonBeforeUnmount(() => formEl?.removeEventListener('reset', onFormReset))\n\ndefineExpose({\n /** Moves the focus to the field. */\n focus: (options?: FocusOptions) => triggerEl.value?.focus(options),\n /** The button that acts as the combobox. */\n el: triggerEl,\n})\n</script>\n\n<template>\n <div\n ref=\"rootEl\"\n class=\"v-select\"\n :class=\"rootClass\"\n :style=\"[{ '--chip-height': chipScale.height }, rootStyle]\"\n :data-size=\"resolvedSize\"\n :data-multiple=\"multiple ? '' : undefined\"\n :data-open=\"open ? '' : undefined\"\n @focusin=\"focused = true\"\n @focusout=\"onFocusout\"\n >\n <div class=\"v-select-control\" @mousedown=\"onControlMousedown\" @click=\"onControlClick\">\n <VInput\n class=\"v-input-end-pinned\"\n :class=\"{ 'v-input-chips': multiple && !textDisplay }\"\n v-bind=\"fieldAttrs\"\n :label=\"label\"\n :hint=\"hint\"\n :error=\"error\"\n :required=\"required\"\n :hide-label=\"hideLabel\"\n :label-position=\"labelPosition\"\n :size=\"resolvedSize\"\n :compact=\"resolvedCompact\"\n :invalid=\"invalid || nativeInvalid\"\n :disabled=\"resolvedDisabled\"\n :readonly=\"readonly\"\n :icon-start=\"iconStart\"\n :icon-start-label=\"iconStartLabel\"\n :clearable=\"clearable\"\n :clear-visible=\"clearVisible\"\n :clear-label=\"resolvedClearLabel\"\n @clear=\"onClear\"\n >\n <template v-if=\"multiple || $slots.start\" #start>\n <VListboxValues\n v-if=\"multiple\"\n :values=\"selectedValues\"\n :display=\"display\"\n :max=\"max\"\n :collapsed=\"collapsed\"\n :overflow-text=\"overflowText\"\n :scale=\"chipScale\"\n :removable=\"!readonly\"\n :disabled=\"resolvedDisabled\"\n hide-text\n :label-of=\"labelOf\"\n :option-of=\"optionOf\"\n @remove=\"removeValue\"\n >\n <template v-if=\"$slots.chip\" #chip=\"chipProps\">\n <slot name=\"chip\" v-bind=\"chipProps\" />\n </template>\n <template v-if=\"$slots.overflow\" #overflow=\"overflowProps\">\n <slot name=\"overflow\" v-bind=\"overflowProps\" />\n </template>\n </VListboxValues>\n <slot name=\"start\" />\n </template>\n\n <template #control=\"{ controlProps }\">\n <button\n ref=\"triggerEl\"\n type=\"button\"\n role=\"combobox\"\n :aria-expanded=\"open\"\n :aria-controls=\"optionsId\"\n :aria-activedescendant=\"open && activeIndex >= 0 ? optionId(activeIndex) : undefined\"\n :aria-required=\"required || undefined\"\n :aria-readonly=\"readonly || undefined\"\n v-bind=\"controlProps\"\n class=\"v-select-trigger\"\n @click=\"togglePanel\"\n @keydown=\"onKeydown\"\n >\n <span\n v-if=\"valueText\"\n class=\"v-select-value\"\n :class=\"{ 'v-visually-hidden': multiple }\"\n >{{ valueText }}</span\n >\n <span v-else-if=\"placeholder\" class=\"v-select-placeholder\">{{ placeholder }}</span>\n </button>\n <!--\n Out of the tab order and hidden from screen readers, it leaves the button as the\n single stop and the single announcement. Its options mirror the flat list: a form\n needs no groups.\n -->\n <select\n ref=\"nativeEl\"\n v-bind=\"nativeAttrs\"\n class=\"v-select-native v-hidden-input\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n :multiple=\"multiple || undefined\"\n :required=\"required || undefined\"\n :disabled=\"resolvedDisabled || undefined\"\n @change=\"onNativeChange\"\n @focus=\"triggerEl?.focus()\"\n @invalid=\"nativeInvalid = true\"\n >\n <option v-if=\"!multiple\" value=\"\" />\n <option\n v-for=\"(option, index) in allOptions\"\n :key=\"index\"\n :value=\"String(option.value)\"\n :disabled=\"option.disabled\"\n >\n {{ option.label }}\n </option>\n </select>\n </template>\n\n <template v-if=\"$slots['value-end']\" #value-end><slot name=\"value-end\" /></template>\n\n <!-- The spinner takes the chevron's place: the field sizes either as an icon. -->\n <template #end>\n <VSpinner v-if=\"loading\" class=\"v-select-spinner v-input-icon-end\" :label=\"loadingText\" />\n <VListboxChevron v-else :icon=\"expandIcon\" :open=\"open\" />\n </template>\n </VInput>\n </div>\n\n <VListboxPanel\n :id=\"optionsId\"\n ref=\"panelRef\"\n v-model:open=\"open\"\n anchor=\"--select-anchor\"\n :placement=\"placement\"\n class=\"v-select-panel\"\n :size=\"resolvedSize\"\n :compact=\"resolvedCompact\"\n :multiple=\"multiple\"\n :blocks=\"blocks\"\n :measure=\"measureRow\"\n @select=\"choose\"\n @highlight=\"hover\"\n >\n <template v-if=\"$slots.option\" #option=\"slotProps\">\n <slot name=\"option\" v-bind=\"slotProps\" />\n </template>\n </VListboxPanel>\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n .v-select {\n /*\n * Declared on the root, the common ancestor of the field and the panel; a panel drawn above\n * the page remains a descendant of it in the document.\n */\n anchor-scope: --select-anchor;\n width: 100%;\n font-family: var(--vectis-text-family);\n }\n\n .v-select-control {\n display: block;\n }\n\n /* The panel opens against the box of the field, not against its label and hint. */\n .v-select-control .v-input-field {\n anchor-name: --select-anchor;\n }\n\n .v-select-panel {\n max-block-size: var(--vectis-control-size-select-list-max-block);\n }\n\n /*\n * VInput's `.v-input-control` gives the button the input's box: it fills the field and draws\n * no border of its own, the field drawing the focus around it.\n */\n .v-select-trigger {\n display: flex;\n align-items: center;\n text-align: start;\n cursor: pointer;\n }\n\n /*\n * Beside chips the button takes what is left of the last row, down to nothing, rather than\n * wrapping onto a row of its own.\n */\n .v-select[data-multiple] .v-select-trigger {\n flex: 1 1 0;\n }\n\n .v-select-value,\n .v-select-placeholder {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .v-select-placeholder {\n color: var(--vectis-color-text-subtle);\n }\n\n .v-select-spinner {\n color: var(--vectis-color-text-muted);\n }\n\n /*\n * An unbroken line has the whole of its text as its min-content width; without this, a grid\n * track or a flex row sized `auto` widens to fit every label and the ellipsis never shows.\n */\n .v-select:has(.v-listbox-text) {\n min-inline-size: 0;\n }\n}\n</style>\n"],"mappings":""}
1
+ {"version":3,"file":"VSelect.js","names":["_sfc_main","VSelect_vue_vue_type_script_setup_true_lang_default","VSelect_default"],"sources":["../../../src/components/VSelect/VSelect.vue"],"sourcesContent":["<script setup lang=\"ts\">\n// @keyboard @a11y @core\n/**\n * A select-only combobox: a native button keeps DOM focus and moves aria-activedescendant through\n * the options, since a native `<select>` cannot draw its list with the design system on every\n * engine. A hidden native `<select>` carries the value into forms, with its constraint\n * validation, autofill and reset.\n */\n\nimport { computed, inject, onBeforeUnmount, onMounted, ref, useId, watch } from 'vue'\n\nimport { expand_more as expandMoreIcon } from '../VIcon/icons/expand_more'\nimport type { IconSource } from '../VIcon/types'\nimport type { FieldLabelPosition } from '../VField/VField.vue'\nimport VInput from '../VInput/VInput.vue'\nimport { inputGroupKey } from '../VInput/context'\nimport VListboxChevron from '../VListbox/VListboxChevron.vue'\nimport VListboxPanel from '../VListbox/VListboxPanel.vue'\nimport VListboxValues from '../VListbox/VListboxValues.vue'\nimport VSpinner from '../VSpinner/VSpinner.vue'\n\nimport type {\n ItemValue,\n ListboxGroup,\n ListboxItem,\n ListboxChipSlotProps,\n ListboxOption,\n ListboxOptionSlotProps,\n ListboxOverflowSlotProps,\n ListboxSeparator,\n} from '../../types'\nimport { toggleValue } from '../../utils/array'\nimport { partitionAttrs } from '../../utils/attrs'\nimport { chipScaleFor } from '../../utils/chip'\nimport { createNormalizedCache } from '../../utils/text'\n\nimport { canClear } from '../../composables/useClearable'\nimport { useControlShape } from '../../composables/useControlShape'\nimport { useFocusoutDismiss } from '../../composables/useFocusoutDismiss'\nimport { iconStartListener } from '../../composables/useIconClickHandlers'\nimport { selectionOf, useListbox } from '../../composables/useListbox'\nimport { useRootAttrs } from '../../composables/useRootAttrs'\nimport { useTypeahead } from '../../composables/useTypeahead'\nimport { useMessages } from '../../i18n/state'\n\n/** One thing that can be chosen. */\nexport type SelectOption = ListboxOption\n\n/** A named block of options, the equivalent of a native `<optgroup>`. */\nexport type SelectGroup = ListboxGroup\n\n/** A rule drawn between two blocks of options, purely decorative. */\nexport type SelectSeparator = ListboxSeparator\n\n/** Anything the list may hold: an option, a named block, or a separator. */\nexport type SelectItem = ListboxItem\n\n/** Where the list opens relative to the field. */\nexport type SelectPlacement =\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'top'\n | 'top-start'\n | 'top-end'\n\n/** The height of the field: 32, 40 or 48 pixels. */\nexport type SelectSize = 'sm' | 'md' | 'lg'\n\n/**\n * How the chosen values are shown in a multiple field: one chip each, or their labels\n * joined by commas.\n */\nexport type SelectDisplay = 'chip' | 'text'\n\n/** What the `#option` slot receives. */\nexport type SelectOptionSlotProps = ListboxOptionSlotProps\n\n/** What the `#chip` slot receives. */\nexport type SelectChipSlotProps = ListboxChipSlotProps\n\n/** What the `#overflow` slot receives. */\nexport type SelectOverflowSlotProps = ListboxOverflowSlotProps\n\ninterface SelectProps {\n /**\n * What the list offers. An entry may be an option, a named block of options, or a\n * separator; a plain list of options remains perfectly valid.\n */\n options: SelectItem[]\n /**\n * Allows several values to be chosen, which makes the value a list and shows what has been\n * chosen inside the field, as chips or as text depending on `display`. The list then stays\n * open while options are toggled.\n */\n multiple?: boolean\n /**\n * How the chosen values are shown when several can be chosen: one dismissible chip each, or\n * their labels joined by commas on a single line, cut short with an ellipsis when they run\n * out of room.\n */\n display?: SelectDisplay\n /**\n * How many chosen values to show while the field is not focused, before the rest are summed\n * up as \"+X\". Left out, or set to 0, every value is shown.\n */\n max?: number\n /**\n * Rephrases the \"+X\" standing for the values beyond `max`, \"+5 products\" for instance.\n * It receives the number of values being hidden.\n */\n overflowText?: (count: number) => string\n /** The label above the field, tied to it so that clicking it focuses the field. */\n label?: string\n /**\n * A line of help under the field. It is tied to the field for assistive technology,\n * so it is read out along with the label.\n */\n hint?: string\n /**\n * A message saying what is wrong with the value, shown in place of the hint so that the field\n * does not grow. It marks the field invalid, is read along with it, and is announced when it\n * appears or changes.\n */\n error?: string\n /**\n * Marks the field as required: an asterisk follows the label, the combobox is announced as\n * required, and the hidden `<select>` a form reads is `required`.\n */\n required?: boolean\n /** Hides the label visually. It still names the field for assistive technology. */\n hideLabel?: boolean\n /**\n * Where the label sits: above the field (`top`, the default), or at its start, in a column of\n * its own, moving back above when there is not room for both.\n */\n labelPosition?: FieldLabelPosition\n /** The height of the field: 32, 40 or 48 pixels. */\n size?: SelectSize\n /** Takes 4px off the height, as everywhere else in the design system. */\n compact?: boolean\n /** What the field says while nothing is chosen. */\n placeholder?: string\n /** Makes the field unusable, greyed out through the colour tokens. Its value is not submitted. */\n disabled?: boolean\n /**\n * Shows what has been chosen without letting it be changed: the field stays focusable and its\n * value is submitted, but the list never opens, the chips lose their crosses and no clear\n * cross is offered.\n */\n readonly?: boolean\n /** Marks the field as invalid, for a rule of your own. */\n invalid?: boolean\n /**\n * An icon inside the field, at the start, before the chips when several values can\n * be chosen. It is decorative by default and becomes a real button as soon as a\n * `@click:icon-start` listener is attached, in which case it needs `iconStartLabel`.\n */\n iconStart?: IconSource\n /** What the start icon does, in words, once it is clickable. */\n iconStartLabel?: string\n /**\n * The chevron at the end of the field, which turns as the list opens: an icon name, or an\n * explicit render.\n */\n expandIcon?: IconSource\n /**\n * Says that the options are being loaded: a spinner takes the chevron's place. The list still\n * opens.\n */\n loading?: boolean\n /** What the spinner is announced as. It falls back to the design system dictionary. */\n loadingText?: string\n /** Offers a cross that empties the selection. */\n clearable?: boolean\n /** What that cross does, in words. It falls back to the design system dictionary. */\n clearLabel?: string\n /** Where the list opens relative to the field. */\n placement?: SelectPlacement\n}\n\nconst props = withDefaults(defineProps<SelectProps>(), {\n multiple: false,\n display: 'chip',\n max: undefined,\n overflowText: undefined,\n label: undefined,\n hint: undefined,\n error: undefined,\n required: false,\n hideLabel: false,\n labelPosition: 'top',\n size: 'md',\n compact: false,\n placeholder: undefined,\n disabled: false,\n readonly: false,\n invalid: false,\n iconStart: undefined,\n iconStartLabel: undefined,\n expandIcon: () => expandMoreIcon,\n loading: false,\n loadingText: undefined,\n clearable: false,\n clearLabel: undefined,\n placement: 'bottom-start',\n})\n\nconst m = useMessages()\nconst resolvedClearLabel = computed(() => props.clearLabel ?? m.value.select.clear)\n\nconst emit = defineEmits<{\n /** The clear cross emptied the selection. */\n clear: []\n /** The start icon was clicked. Attaching this listener is what makes it a button. */\n 'click:icon-start': [event: MouseEvent]\n}>()\n\ndefineSlots<{\n /**\n * Content at the start of the field, rendered after the chips standing for the chosen\n * values rather than in their place.\n */\n start?(): unknown\n /**\n * Controls of your own inside the field, placed before the ones the field owns: the clear\n * cross and the chevron.\n */\n 'value-end'?(): unknown\n /** What a row of the list shows, in place of the plain label: a subtitle, an avatar, a badge. */\n option?(props: SelectOptionSlotProps): unknown\n /** Replaces the chip standing for one chosen value. */\n chip?(props: SelectChipSlotProps): unknown\n /** Replaces the \"+X\" standing for the values beyond `max`. */\n overflow?(props: SelectOverflowSlotProps): unknown\n}>()\n\nconst group = inject(inputGroupKey, null)\nconst {\n size: resolvedSize,\n compact: resolvedCompact,\n disabled: resolvedDisabled,\n} = useControlShape(props, group)\n\nconst chipScale = computed(() => chipScaleFor(resolvedSize.value, resolvedCompact.value))\n\n/** The chosen option's `value`, `''` while nothing is chosen, or the list of them when `multiple` is set. */\nconst model = defineModel<ItemValue | ItemValue[]>({ default: '' })\n\n// `class` and `style` stay on the wrapper; the form attributes go to the hidden `<select>`, which\n// is what a form reads; everything else goes down to the button, the element assistive\n// technology treats as the combobox.\ndefineOptions({ inheritAttrs: false })\nconst { rootClass, rootStyle, forwardedAttrs } = useRootAttrs()\n\nconst NATIVE_ONLY = ['name', 'form', 'autocomplete']\nconst split = computed(() => partitionAttrs(forwardedAttrs.value, NATIVE_ONLY))\nconst nativeAttrs = computed(() => split.value.picked)\n\n// Declared as this component's own event, `click:icon-start` is out of `$attrs`, so the\n// listener is relayed to the field by hand; and only when the consumer wrote one.\nconst iconStartClick = iconStartListener((event) => emit('click:icon-start', event))\nconst fieldAttrs = computed(() => ({ ...split.value.rest, ...iconStartClick }))\n\nconst rootEl = ref<HTMLElement | null>(null)\nconst triggerEl = ref<HTMLButtonElement | null>(null)\nconst nativeEl = ref<HTMLSelectElement | null>(null)\nconst panelRef = ref<InstanceType<typeof VListboxPanel> | null>(null)\nconst optionsId = useId()\n\nconst open = ref(false)\nconst focused = ref(false)\n\nconst selectedValues = computed(() => selectionOf(model.value, props.multiple))\n\nconst {\n allOptions,\n visible,\n optionOf,\n labelOf,\n remember,\n activeIndex,\n optionId,\n highlightFirst,\n highlightLast,\n highlightSelected,\n move,\n page,\n hover,\n blocks,\n measureRow,\n} = useListbox({\n items: () => props.options,\n selected: () => selectedValues.value,\n open: () => open.value,\n id: optionsId,\n panelEl: () => panelRef.value?.el ?? null,\n virtual: () => false,\n size: () => resolvedSize.value,\n compact: () => resolvedCompact.value,\n})\n\n// @a11y\n// What the button says, which assistive technology reads as the combobox's value: the chosen\n// label, or every chosen label when the chips beside it show them.\nconst valueText = computed(() => selectedValues.value.map(labelOf).join(', '))\n\nconst textDisplay = computed(() => props.multiple && props.display === 'text')\n\n// Folded, the values beyond `max` are summed up; under the focus, every value is there to be\n// seen and taken back.\nconst collapsed = computed(() => props.multiple && !focused.value && !open.value)\n\nconst clearVisible = computed(() =>\n canClear(props, resolvedDisabled.value, selectedValues.value.length > 0),\n)\n\n/** Whether the hidden `<select>` failed validation since the value last changed. */\nconst nativeInvalid = ref(false)\n\nfunction openPanel() {\n if (resolvedDisabled.value || props.readonly || open.value) return\n open.value = true\n highlightSelected()\n}\n\nfunction closePanel() {\n if (!open.value) return\n open.value = false\n activeIndex.value = -1\n}\n\nfunction togglePanel() {\n if (open.value) closePanel()\n else openPanel()\n}\n\nconst onFocusout = useFocusoutDismiss(rootEl, () => {\n focused.value = false\n closePanel()\n})\n\nfunction choose(option: SelectOption) {\n if (option.disabled || props.readonly || resolvedDisabled.value) return\n remember(option)\n if (props.multiple) {\n model.value = toggleValue(selectedValues.value, option.value)\n } else {\n // Choosing the option already chosen (Tab without moving, for one) changes nothing.\n if (model.value !== option.value) model.value = option.value\n closePanel()\n }\n}\n\nfunction chooseActive() {\n const option = visible.value[activeIndex.value]\n if (option) choose(option)\n}\n\nfunction removeValue(value: ItemValue) {\n if (!props.multiple || props.readonly || resolvedDisabled.value) return\n model.value = selectedValues.value.filter((v) => v !== value)\n // The cross disappears along with its chip, so the focus would fall back to the page.\n triggerEl.value?.focus()\n}\n\n/** The cross was pressed. It disappears with the selection, so the focus goes back to the button. */\nfunction onClear() {\n model.value = props.multiple ? [] : ''\n triggerEl.value?.focus()\n emit('clear')\n}\n\nconst normalizedOf = createNormalizedCache<SelectOption>()\nconst { find: findTyped, typing } = useTypeahead()\n\n// @keyboard\n// Typing a label's first letters highlights it.\nfunction typeahead(key: string) {\n const list = visible.value\n const index = findTyped(key, list.length, activeIndex.value, (i) => {\n const option = list[i]!\n return option.disabled ? undefined : normalizedOf(option, option.label)\n })\n if (index >= 0) activeIndex.value = index\n}\n\nconst printable = (event: KeyboardEvent) =>\n event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey\n\n// @keyboard\n// The keys of the select-only combobox pattern. Enter and Space are consumed on the closed button\n// too, so the click they would synthesise does not toggle the list a second time.\nfunction onKeydown(event: KeyboardEvent) {\n if (!open.value) {\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowUp':\n case 'Enter':\n case ' ':\n event.preventDefault()\n openPanel()\n return\n case 'Home':\n event.preventDefault()\n openPanel()\n if (open.value) highlightFirst()\n return\n case 'End':\n event.preventDefault()\n openPanel()\n if (open.value) highlightLast()\n return\n }\n if (printable(event)) {\n openPanel()\n if (open.value) typeahead(event.key)\n }\n return\n }\n\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault()\n move(1)\n break\n case 'ArrowUp':\n event.preventDefault()\n if (event.altKey) {\n chooseActive()\n closePanel()\n } else move(-1)\n break\n case 'Home':\n event.preventDefault()\n highlightFirst()\n break\n case 'End':\n event.preventDefault()\n highlightLast()\n break\n case 'PageDown':\n event.preventDefault()\n page(10)\n break\n case 'PageUp':\n event.preventDefault()\n page(-10)\n break\n case ' ':\n event.preventDefault()\n // While letters are being typed, a space belongs to the prefix: \"New York\".\n if (typing()) typeahead(' ')\n else chooseActive()\n break\n case 'Enter':\n event.preventDefault()\n chooseActive()\n break\n case 'Escape':\n // Consumed only when it closes the list, so a surrounding VDialog stays open.\n event.preventDefault()\n closePanel()\n break\n case 'Tab':\n // Leaving a single list takes the highlighted option, as the pattern prescribes.\n if (!props.multiple) chooseActive()\n closePanel()\n break\n default:\n if (printable(event)) typeahead(event.key)\n }\n}\n\nconst interactive = 'a, button, input, select, textarea, [tabindex]'\n\n// @core\n/*\n * The rest of the field is not focusable, so pressing it would hand the focus to the page: the\n * root's `focusout` then closes the list, and the click that follows reopens it.\n */\nfunction onControlMousedown(event: MouseEvent) {\n const target = event.target as Element\n if (target.closest('.v-input-field') && !target.closest(interactive)) event.preventDefault()\n}\n\n/**\n * A click anywhere in the box of the field toggles the list, as one on the button does. The\n * field's own controls keep their clicks, and the label's reaches the button by itself.\n */\nfunction onControlClick(event: MouseEvent) {\n const target = event.target as Element\n if (resolvedDisabled.value || !target.closest('.v-input-field') || target.closest(interactive))\n return\n triggerEl.value?.focus()\n togglePanel()\n}\n\n/*\n * The hidden `<select>` is written by hand rather than through `selected` bindings: a form reset\n * changes it behind the virtual DOM's back, which would then consider unchanged options already\n * in the right state.\n */\nfunction syncNative() {\n const el = nativeEl.value\n if (!el) return\n for (const option of el.options) {\n option.selected = option.value !== '' && wantedValues.value.has(option.value)\n }\n if (!props.multiple && selectedValues.value.length === 0) el.value = ''\n}\n\nconst wantedValues = computed(() => new Set(selectedValues.value.map(String)))\n\nwatch([selectedValues, allOptions], syncNative, { flush: 'post' })\n\n// A choice that satisfies the constraint clears the error the last submission raised; one that\n// does not raises it again, `checkValidity` firing `invalid`.\nwatch(\n selectedValues,\n () => {\n if (nativeInvalid.value) nativeInvalid.value = !nativeEl.value?.checkValidity()\n },\n { flush: 'post' },\n)\n\n/** Autofill writes the hidden `<select>`; the strings it holds are read back as option values. */\nfunction onNativeChange() {\n const el = nativeEl.value\n if (!el) return\n const values = [...el.selectedOptions]\n .map((native) => allOptions.value.find((option) => String(option.value) === native.value))\n .filter((option): option is SelectOption => option !== undefined)\n .map((option) => option.value)\n model.value = props.multiple ? values : (values[0] ?? '')\n}\n\n// @core\n// A form reset restores the value the field was created with. The browser resets the hidden\n// `<select>` after the event, so it is rewritten on the next task.\nlet initial: ItemValue | ItemValue[] = ''\nlet formEl: HTMLFormElement | null = null\n\nfunction onFormReset() {\n model.value = Array.isArray(initial) ? [...initial] : initial\n nativeInvalid.value = false\n setTimeout(syncNative)\n}\n\nonMounted(() => {\n initial = Array.isArray(model.value) ? [...model.value] : model.value\n syncNative()\n formEl = nativeEl.value?.form ?? null\n formEl?.addEventListener('reset', onFormReset)\n})\n\nonBeforeUnmount(() => formEl?.removeEventListener('reset', onFormReset))\n\ndefineExpose({\n /** Moves the focus to the field. */\n focus: (options?: FocusOptions) => triggerEl.value?.focus(options),\n /** The button that acts as the combobox. */\n el: triggerEl,\n})\n</script>\n\n<template>\n <div\n ref=\"rootEl\"\n class=\"v-select\"\n :class=\"rootClass\"\n :style=\"[{ '--chip-height': chipScale.height }, rootStyle]\"\n :data-size=\"resolvedSize\"\n :data-multiple=\"multiple ? '' : undefined\"\n :data-open=\"open ? '' : undefined\"\n @focusin=\"focused = true\"\n @focusout=\"onFocusout\"\n >\n <div class=\"v-select-control\" @mousedown=\"onControlMousedown\" @click=\"onControlClick\">\n <VInput\n class=\"v-input-end-pinned\"\n :class=\"{ 'v-input-chips': multiple && !textDisplay }\"\n v-bind=\"fieldAttrs\"\n :label=\"label\"\n :hint=\"hint\"\n :error=\"error\"\n :required=\"required\"\n :hide-label=\"hideLabel\"\n :label-position=\"labelPosition\"\n :size=\"resolvedSize\"\n :compact=\"resolvedCompact\"\n :invalid=\"invalid || nativeInvalid\"\n :disabled=\"resolvedDisabled\"\n :readonly=\"readonly\"\n :icon-start=\"iconStart\"\n :icon-start-label=\"iconStartLabel\"\n :clearable=\"clearable\"\n :clear-visible=\"clearVisible\"\n :clear-label=\"resolvedClearLabel\"\n @clear=\"onClear\"\n >\n <template v-if=\"multiple || $slots.start\" #start>\n <VListboxValues\n v-if=\"multiple\"\n :values=\"selectedValues\"\n :display=\"display\"\n :max=\"max\"\n :collapsed=\"collapsed\"\n :overflow-text=\"overflowText\"\n :scale=\"chipScale\"\n :removable=\"!readonly\"\n :disabled=\"resolvedDisabled\"\n hide-text\n :label-of=\"labelOf\"\n :option-of=\"optionOf\"\n @remove=\"removeValue\"\n >\n <template v-if=\"$slots.chip\" #chip=\"chipProps\">\n <slot name=\"chip\" v-bind=\"chipProps\" />\n </template>\n <template v-if=\"$slots.overflow\" #overflow=\"overflowProps\">\n <slot name=\"overflow\" v-bind=\"overflowProps\" />\n </template>\n </VListboxValues>\n <slot name=\"start\" />\n </template>\n\n <template #control=\"{ controlProps }\">\n <button\n ref=\"triggerEl\"\n type=\"button\"\n role=\"combobox\"\n :aria-expanded=\"open\"\n :aria-controls=\"optionsId\"\n :aria-activedescendant=\"open && activeIndex >= 0 ? optionId(activeIndex) : undefined\"\n :aria-required=\"required || undefined\"\n :aria-readonly=\"readonly || undefined\"\n v-bind=\"controlProps\"\n class=\"v-select-trigger\"\n @click=\"togglePanel\"\n @keydown=\"onKeydown\"\n >\n <span\n v-if=\"valueText\"\n class=\"v-select-value\"\n :class=\"{ 'v-visually-hidden': multiple }\"\n >{{ valueText }}</span\n >\n <span v-else-if=\"placeholder\" class=\"v-select-placeholder\">{{ placeholder }}</span>\n </button>\n <!--\n Out of the tab order and hidden from screen readers, it leaves the button as the\n single stop and the single announcement. Its options mirror the flat list: a form\n needs no groups.\n -->\n <select\n ref=\"nativeEl\"\n v-bind=\"nativeAttrs\"\n class=\"v-select-native v-hidden-input\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n :multiple=\"multiple || undefined\"\n :required=\"required || undefined\"\n :disabled=\"resolvedDisabled || undefined\"\n @change=\"onNativeChange\"\n @focus=\"triggerEl?.focus()\"\n @invalid=\"nativeInvalid = true\"\n >\n <option v-if=\"!multiple\" value=\"\" />\n <option\n v-for=\"(option, index) in allOptions\"\n :key=\"index\"\n :value=\"String(option.value)\"\n :disabled=\"option.disabled\"\n >\n {{ option.label }}\n </option>\n </select>\n </template>\n\n <template v-if=\"$slots['value-end']\" #value-end><slot name=\"value-end\" /></template>\n\n <!-- The spinner takes the chevron's place: the field sizes either as an icon. -->\n <template #end>\n <VSpinner v-if=\"loading\" class=\"v-select-spinner v-input-icon-end\" :label=\"loadingText\" />\n <VListboxChevron v-else :icon=\"expandIcon\" :open=\"open\" />\n </template>\n </VInput>\n </div>\n\n <VListboxPanel\n :id=\"optionsId\"\n ref=\"panelRef\"\n v-model:open=\"open\"\n anchor=\"--select-anchor\"\n :placement=\"placement\"\n class=\"v-select-panel\"\n :size=\"resolvedSize\"\n :compact=\"resolvedCompact\"\n :multiple=\"multiple\"\n :blocks=\"blocks\"\n :measure=\"measureRow\"\n @select=\"choose\"\n @highlight=\"hover\"\n >\n <template v-if=\"$slots.option\" #option=\"slotProps\">\n <slot name=\"option\" v-bind=\"slotProps\" />\n </template>\n </VListboxPanel>\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n .v-select {\n /*\n * Declared on the root, the common ancestor of the field and the panel; a panel drawn above\n * the page remains a descendant of it in the document.\n */\n anchor-scope: --select-anchor;\n width: 100%;\n font-family: var(--vectis-text-family);\n }\n\n .v-select-control {\n display: block;\n }\n\n /* The panel opens against the box of the field, not against its label and hint. */\n .v-select-control .v-input-field {\n anchor-name: --select-anchor;\n }\n\n .v-select-panel {\n max-block-size: var(--vectis-control-size-select-list-max-block);\n }\n\n /*\n * VInput's `.v-input-control` gives the button the input's box: it fills the field and draws\n * no border of its own, the field drawing the focus around it.\n */\n .v-select-trigger {\n display: flex;\n align-items: center;\n text-align: start;\n cursor: pointer;\n }\n\n /*\n * Beside chips the button takes what is left of the last row, down to nothing, rather than\n * wrapping onto a row of its own.\n */\n .v-select[data-multiple] .v-select-trigger {\n flex: 1 1 0;\n }\n\n .v-select-value,\n .v-select-placeholder {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .v-select-placeholder {\n color: var(--vectis-color-text-subtle);\n }\n\n .v-select-spinner {\n color: var(--vectis-color-text-muted);\n }\n\n /*\n * An unbroken line has the whole of its text as its min-content width; without this, a grid\n * track or a flex row sized `auto` widens to fit every label and the ellipsis never shows.\n */\n .v-select:has(.v-listbox-text) {\n min-inline-size: 0;\n }\n}\n</style>\n"],"mappings":""}