vectis-ui 0.12.0 → 0.13.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.
- package/dist/components/VAccordion/VAccordion.css +1 -1
- package/dist/components/VAccordion/VAccordion.d.ts +6 -5
- package/dist/components/VAccordion/VAccordion.js.map +1 -1
- package/dist/components/VAccordion/VAccordion.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VAccordion/VAccordionItem.css +1 -1
- package/dist/components/VAccordion/VAccordionItem.d.ts +1 -1
- package/dist/components/VAccordion/VAccordionItem.js.map +1 -1
- package/dist/components/VAccordion/VAccordionItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VAlert/VAlert.css +2 -0
- package/dist/components/VAlert/VAlert.d.ts +73 -0
- package/dist/components/VAlert/VAlert.js +9 -0
- package/dist/components/VAlert/VAlert.js.map +1 -0
- package/dist/components/VAlert/VAlert.vue_vue_type_script_setup_true_lang.js +96 -0
- package/dist/components/VAlert/VAlert.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VAvatar/VAvatar.d.ts +2 -2
- package/dist/components/VAvatar/VAvatarGroup.d.ts +1 -1
- package/dist/components/VAvatar/VAvatarGroup.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/components/VBadge/VBadge.d.ts +3 -3
- package/dist/components/VBreadcrumb/VBreadcrumb.vue_vue_type_script_setup_true_lang.js +9 -9
- package/dist/components/VButton/VButton.d.ts +4 -4
- package/dist/components/VButton/VButtonGroup.css +1 -1
- package/dist/components/VButton/VButtonGroup.d.ts +2 -2
- package/dist/components/VButton/VButtonGroup.js.map +1 -1
- package/dist/components/VButton/VButtonGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCalendar/VCalendar.css +1 -1
- package/dist/components/VCalendar/VCalendar.d.ts +7 -1
- package/dist/components/VCalendar/VCalendar.js.map +1 -1
- package/dist/components/VCalendar/VCalendar.vue_vue_type_script_setup_true_lang.js +20 -18
- package/dist/components/VCalendar/VCalendar.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCalendar/VCalendarEvent.js.map +1 -1
- package/dist/components/VCalendar/VCalendarEvent.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCalendar/VCalendarMonth.css +1 -1
- package/dist/components/VCalendar/VCalendarMonth.d.ts +2 -2
- package/dist/components/VCalendar/VCalendarMonth.js.map +1 -1
- package/dist/components/VCalendar/VCalendarMonth.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCalendar/VCalendarTimeGrid.css +1 -1
- package/dist/components/VCalendar/VCalendarTimeGrid.d.ts +3 -3
- package/dist/components/VCalendar/VCalendarTimeGrid.js.map +1 -1
- package/dist/components/VCalendar/VCalendarTimeGrid.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCalendar/VCalendarYear.css +1 -1
- package/dist/components/VCalendar/VCalendarYear.js.map +1 -1
- package/dist/components/VCalendar/VCalendarYear.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCalendar/gesture.d.ts +1 -16
- package/dist/components/VCalendar/gesture.js +1 -1
- package/dist/components/VCalendar/gesture.js.map +1 -1
- package/dist/components/VCalendar/types.d.ts +2 -0
- package/dist/components/VCard/VCard.css +2 -0
- package/dist/components/VCard/VCard.d.ts +87 -0
- package/dist/components/VCard/VCard.js +9 -0
- package/dist/components/VCard/VCard.js.map +1 -0
- package/dist/components/VCard/VCard.vue_vue_type_script_setup_true_lang.js +103 -0
- package/dist/components/VCard/VCard.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VCarousel/VCarousel.d.ts +1 -1
- package/dist/components/VCarousel/VCarousel.js.map +1 -1
- package/dist/components/VCarousel/VCarousel.vue_vue_type_script_setup_true_lang.js +18 -18
- package/dist/components/VCarousel/VCarousel.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCheckbox/VCheckMark.css +2 -0
- package/dist/components/VCheckbox/VCheckMark.js +9 -0
- package/dist/components/VCheckbox/VCheckMark.js.map +1 -0
- package/dist/components/VCheckbox/VCheckMark.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/components/VCheckbox/VCheckMark.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VCheckbox/VCheckbox.css +1 -1
- package/dist/components/VCheckbox/VCheckbox.d.ts +8 -3
- package/dist/components/VCheckbox/VCheckbox.js.map +1 -1
- package/dist/components/VCheckbox/VCheckbox.vue_vue_type_script_setup_true_lang.js +54 -69
- package/dist/components/VCheckbox/VCheckbox.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VChip/VChip.d.ts +6 -6
- package/dist/components/VChip/VChip.js.map +1 -1
- package/dist/components/VChip/VChip.vue_vue_type_script_setup_true_lang.js +26 -26
- package/dist/components/VChip/VChip.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VColorInput/VColorInput.css +2 -0
- package/dist/components/VColorInput/VColorInput.d.ts +113 -0
- package/dist/components/VColorInput/VColorInput.js +9 -0
- package/dist/components/VColorInput/VColorInput.js.map +1 -0
- package/dist/components/VColorInput/VColorInput.vue_vue_type_script_setup_true_lang.js +230 -0
- package/dist/components/VColorInput/VColorInput.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VColorPicker/VColorPicker.css +2 -0
- package/dist/components/VColorPicker/VColorPicker.d.ts +67 -0
- package/dist/components/VColorPicker/VColorPicker.js +9 -0
- package/dist/components/VColorPicker/VColorPicker.js.map +1 -0
- package/dist/components/VColorPicker/VColorPicker.vue_vue_type_script_setup_true_lang.js +390 -0
- package/dist/components/VColorPicker/VColorPicker.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VColorPicker/color.d.ts +42 -0
- package/dist/components/VColorPicker/color.js +158 -0
- package/dist/components/VColorPicker/color.js.map +1 -0
- package/dist/components/VCombobox/VCombobox.css +1 -1
- package/dist/components/VCombobox/VCombobox.d.ts +46 -60
- package/dist/components/VCombobox/VCombobox.js.map +1 -1
- package/dist/components/VCombobox/VCombobox.vue_vue_type_script_setup_true_lang.js +271 -372
- package/dist/components/VCombobox/VCombobox.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCommandPalette/VCommandPalette.css +2 -0
- package/dist/components/VCommandPalette/VCommandPalette.d.ts +163 -0
- package/dist/components/VCommandPalette/VCommandPalette.js +9 -0
- package/dist/components/VCommandPalette/VCommandPalette.js.map +1 -0
- package/dist/components/VCommandPalette/VCommandPalette.vue_vue_type_script_setup_true_lang.js +321 -0
- package/dist/components/VCommandPalette/VCommandPalette.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VCommandPalette/VCommandPaletteItem.css +2 -0
- package/dist/components/VCommandPalette/VCommandPaletteItem.d.ts +38 -0
- package/dist/components/VCommandPalette/VCommandPaletteItem.js +9 -0
- package/dist/components/VCommandPalette/VCommandPaletteItem.js.map +1 -0
- package/dist/components/VCommandPalette/VCommandPaletteItem.vue_vue_type_script_setup_true_lang.js +69 -0
- package/dist/components/VCommandPalette/VCommandPaletteItem.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VContextMenu/VContextMenu.css +2 -0
- package/dist/components/VContextMenu/VContextMenu.d.ts +66 -0
- package/dist/components/VContextMenu/VContextMenu.js +9 -0
- package/dist/components/VContextMenu/VContextMenu.js.map +1 -0
- package/dist/components/VContextMenu/VContextMenu.vue_vue_type_script_setup_true_lang.js +148 -0
- package/dist/components/VContextMenu/VContextMenu.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VDataTable/VDataTable.css +1 -1
- package/dist/components/VDataTable/VDataTable.d.ts +41 -16
- package/dist/components/VDataTable/VDataTable.js.map +1 -1
- package/dist/components/VDataTable/VDataTable.vue_vue_type_script_setup_true_lang.js +307 -195
- package/dist/components/VDataTable/VDataTable.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VDateInput/VDateInput.d.ts +27 -7
- package/dist/components/VDateInput/VDateInput.js.map +1 -1
- package/dist/components/VDateInput/VDateInput.vue_vue_type_script_setup_true_lang.js +170 -162
- package/dist/components/VDateInput/VDateInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VDatePicker/VDatePicker.d.ts +3 -3
- package/dist/components/VDatePicker/VDatePicker.js.map +1 -1
- package/dist/components/VDatePicker/VDatePicker.vue_vue_type_script_setup_true_lang.js +228 -227
- package/dist/components/VDatePicker/VDatePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VDatePicker/keyboard.d.ts +7 -7
- package/dist/components/VDatePicker/keyboard.js +8 -6
- package/dist/components/VDatePicker/keyboard.js.map +1 -1
- package/dist/components/VDatePicker/names.js +16 -20
- package/dist/components/VDatePicker/names.js.map +1 -1
- package/dist/components/VDialog/VDialog.d.ts +2 -4
- package/dist/components/VDialog/VDialog.js.map +1 -1
- package/dist/components/VDialog/VDialog.vue_vue_type_script_setup_true_lang.js +46 -77
- package/dist/components/VDialog/VDialog.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VDrawer/VDrawer.css +2 -0
- package/dist/components/VDrawer/VDrawer.d.ts +102 -0
- package/dist/components/VDrawer/VDrawer.js +9 -0
- package/dist/components/VDrawer/VDrawer.js.map +1 -0
- package/dist/components/VDrawer/VDrawer.vue_vue_type_script_setup_true_lang.js +128 -0
- package/dist/components/VDrawer/VDrawer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VEmptyState/VEmptyState.css +2 -0
- package/dist/components/VEmptyState/VEmptyState.d.ts +43 -0
- package/dist/components/VEmptyState/VEmptyState.js +9 -0
- package/dist/components/VEmptyState/VEmptyState.js.map +1 -0
- package/dist/components/VEmptyState/VEmptyState.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/components/VEmptyState/VEmptyState.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VField/VField.css +2 -0
- package/dist/components/VField/VField.d.ts +84 -0
- package/dist/components/VField/VField.js +9 -0
- package/dist/components/VField/VField.js.map +1 -0
- package/dist/components/VField/VField.vue_vue_type_script_setup_true_lang.js +99 -0
- package/dist/components/VField/VField.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VField/VFieldAnnouncer.d.ts +7 -0
- package/dist/components/VField/VFieldAnnouncer.js +7 -0
- package/dist/components/VField/VFieldAnnouncer.js.map +1 -0
- package/dist/components/VField/VFieldAnnouncer.vue_vue_type_script_setup_true_lang.js +19 -0
- package/dist/components/VField/VFieldAnnouncer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VField/VFieldMessage.d.ts +11 -0
- package/dist/components/VField/VFieldMessage.js +7 -0
- package/dist/components/VField/VFieldMessage.js.map +1 -0
- package/dist/components/VField/VFieldMessage.vue_vue_type_script_setup_true_lang.js +32 -0
- package/dist/components/VField/VFieldMessage.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VFieldset/VFieldset.css +2 -0
- package/dist/components/VFieldset/VFieldset.d.ts +52 -0
- package/dist/components/VFieldset/VFieldset.js +9 -0
- package/dist/components/VFieldset/VFieldset.js.map +1 -0
- package/dist/components/VFieldset/VFieldset.vue_vue_type_script_setup_true_lang.js +63 -0
- package/dist/components/VFieldset/VFieldset.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VFileInput/VFileInput.css +1 -1
- package/dist/components/VFileInput/VFileInput.d.ts +31 -7
- package/dist/components/VFileInput/VFileInput.js.map +1 -1
- package/dist/components/VFileInput/VFileInput.vue_vue_type_script_setup_true_lang.js +168 -161
- package/dist/components/VFileInput/VFileInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VFilePicker/VFilePicker.d.ts +4 -4
- package/dist/components/VHotkeys/VHotkeys.css +1 -1
- package/dist/components/VHotkeys/VHotkeys.js.map +1 -1
- package/dist/components/VHotkeys/VHotkeys.vue_vue_type_script_setup_true_lang.js +27 -30
- package/dist/components/VHotkeys/VHotkeys.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VHotkeys/platform.d.ts +2 -0
- package/dist/components/VHotkeys/platform.js +24 -5
- package/dist/components/VHotkeys/platform.js.map +1 -1
- package/dist/components/VHoverCard/VHoverCard.css +2 -0
- package/dist/components/VHoverCard/VHoverCard.d.ts +62 -0
- package/dist/components/VHoverCard/VHoverCard.js +9 -0
- package/dist/components/VHoverCard/VHoverCard.js.map +1 -0
- package/dist/components/VHoverCard/VHoverCard.vue_vue_type_script_setup_true_lang.js +97 -0
- package/dist/components/VHoverCard/VHoverCard.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VIcon/icons/add.d.ts +5 -0
- package/dist/components/VIcon/icons/add.js +9 -0
- package/dist/components/VIcon/icons/add.js.map +1 -0
- package/dist/components/VIcon/icons/colorize.d.ts +5 -0
- package/dist/components/VIcon/icons/colorize.js +9 -0
- package/dist/components/VIcon/icons/colorize.js.map +1 -0
- package/dist/components/VIcon/icons/inbox.d.ts +5 -0
- package/dist/components/VIcon/icons/inbox.js +9 -0
- package/dist/components/VIcon/icons/inbox.js.map +1 -0
- package/dist/components/VIcon/icons/index.d.ts +42 -2
- package/dist/components/VIcon/icons/index.js +88 -72
- package/dist/components/VIcon/icons/index.js.map +1 -1
- package/dist/components/VIcon/icons/names.d.ts +2 -2
- package/dist/components/VIcon/icons/names.js +1 -1
- package/dist/components/VIcon/icons/names.js.map +1 -1
- package/dist/components/VIcon/icons/open_in_new.d.ts +5 -0
- package/dist/components/VIcon/icons/open_in_new.js +9 -0
- package/dist/components/VIcon/icons/open_in_new.js.map +1 -0
- package/dist/components/VIcon/icons/priority_high.d.ts +5 -0
- package/dist/components/VIcon/icons/priority_high.js +9 -0
- package/dist/components/VIcon/icons/priority_high.js.map +1 -0
- package/dist/components/VIcon/icons/remove.d.ts +5 -0
- package/dist/components/VIcon/icons/remove.js +9 -0
- package/dist/components/VIcon/icons/remove.js.map +1 -0
- package/dist/components/VIcon/icons/search_off.d.ts +5 -0
- package/dist/components/VIcon/icons/search_off.js +9 -0
- package/dist/components/VIcon/icons/search_off.js.map +1 -0
- package/dist/components/VIcon/icons/star.d.ts +5 -0
- package/dist/components/VIcon/icons/star.js +9 -0
- package/dist/components/VIcon/icons/star.js.map +1 -0
- package/dist/components/VIconButton/VIconButton.d.ts +4 -4
- package/dist/components/VInput/VInput.css +1 -1
- package/dist/components/VInput/VInput.d.ts +51 -2
- package/dist/components/VInput/VInput.js.map +1 -1
- package/dist/components/VInput/VInput.vue_vue_type_script_setup_true_lang.js +129 -106
- package/dist/components/VInput/VInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VInput/VInputGroup.css +1 -1
- package/dist/components/VInput/VInputGroup.d.ts +20 -0
- package/dist/components/VInput/VInputGroup.js.map +1 -1
- package/dist/components/VInput/VInputGroup.vue_vue_type_script_setup_true_lang.js +50 -51
- package/dist/components/VInput/VInputGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VInputOTP/VInputOTP.css +1 -1
- package/dist/components/VInputOTP/VInputOTP.d.ts +27 -4
- package/dist/components/VInputOTP/VInputOTP.js.map +1 -1
- package/dist/components/VInputOTP/VInputOTP.vue_vue_type_script_setup_true_lang.js +131 -113
- package/dist/components/VInputOTP/VInputOTP.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VLink/VLink.css +2 -0
- package/dist/components/VLink/VLink.d.ts +53 -0
- package/dist/components/VLink/VLink.js +9 -0
- package/dist/components/VLink/VLink.js.map +1 -0
- package/dist/components/VLink/VLink.vue_vue_type_script_setup_true_lang.js +58 -0
- package/dist/components/VLink/VLink.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VListbox/VListboxChevron.css +2 -0
- package/dist/components/VListbox/VListboxChevron.d.ts +12 -0
- package/dist/components/VListbox/VListboxChevron.js +9 -0
- package/dist/components/VListbox/VListboxChevron.js.map +1 -0
- package/dist/components/VListbox/VListboxChevron.vue_vue_type_script_setup_true_lang.js +25 -0
- package/dist/components/VListbox/VListboxChevron.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VListbox/VListboxGroup.css +2 -0
- package/dist/components/VListbox/VListboxGroup.d.ts +27 -0
- package/dist/components/VListbox/VListboxGroup.js +9 -0
- package/dist/components/VListbox/VListboxGroup.js.map +1 -0
- package/dist/components/VListbox/VListboxGroup.vue_vue_type_script_setup_true_lang.js +21 -0
- package/dist/components/VListbox/VListboxGroup.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VListbox/VListboxOption.css +2 -0
- package/dist/components/{VCombobox/VComboboxOption.d.ts → VListbox/VListboxOption.d.ts} +4 -4
- package/dist/components/VListbox/VListboxOption.js +9 -0
- package/dist/components/VListbox/VListboxOption.js.map +1 -0
- package/dist/components/{VCombobox/VComboboxOption.vue_vue_type_script_setup_true_lang.js → VListbox/VListboxOption.vue_vue_type_script_setup_true_lang.js} +6 -6
- package/dist/components/VListbox/VListboxOption.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VListbox/VListboxPanel.css +2 -0
- package/dist/components/VListbox/VListboxPanel.d.ts +59 -0
- package/dist/components/VListbox/VListboxPanel.js +9 -0
- package/dist/components/VListbox/VListboxPanel.js.map +1 -0
- package/dist/components/VListbox/VListboxPanel.vue_vue_type_script_setup_true_lang.js +123 -0
- package/dist/components/VListbox/VListboxPanel.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VListbox/VListboxSeparator.css +2 -0
- package/dist/components/VListbox/VListboxSeparator.d.ts +3 -0
- package/dist/components/VListbox/VListboxSeparator.js +9 -0
- package/dist/components/VListbox/VListboxSeparator.js.map +1 -0
- package/dist/components/{VCombobox/VComboboxSeparator.vue_vue_type_script_setup_true_lang.js → VListbox/VListboxSeparator.vue_vue_type_script_setup_true_lang.js} +4 -4
- package/dist/components/VListbox/VListboxSeparator.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VListbox/VListboxValues.css +2 -0
- package/dist/components/VListbox/VListboxValues.d.ts +52 -0
- package/dist/components/VListbox/VListboxValues.js +9 -0
- package/dist/components/VListbox/VListboxValues.js.map +1 -0
- package/dist/components/VListbox/VListboxValues.vue_vue_type_script_setup_true_lang.js +103 -0
- package/dist/components/VListbox/VListboxValues.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VMenu/VMenu.d.ts +1 -1
- package/dist/components/VMenu/VMenu.vue_vue_type_script_setup_true_lang.js +9 -9
- package/dist/components/VMenu/VMenuItem.d.ts +1 -1
- package/dist/components/VMenu/VMenuItem.vue_vue_type_script_setup_true_lang.js +16 -16
- package/dist/components/VMenu/VMenuPanel.d.ts +2 -2
- package/dist/components/VMenu/VMenuPanel.js.map +1 -1
- package/dist/components/VMenu/VMenuPanel.vue_vue_type_script_setup_true_lang.js +7 -7
- package/dist/components/VMenu/VMenuPanel.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VMeter/VMeter.css +2 -0
- package/dist/components/VMeter/VMeter.d.ts +77 -0
- package/dist/components/VMeter/VMeter.js +9 -0
- package/dist/components/VMeter/VMeter.js.map +1 -0
- package/dist/components/VMeter/VMeter.vue_vue_type_script_setup_true_lang.js +113 -0
- package/dist/components/VMeter/VMeter.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VNumberInput/VNumberInput.css +2 -0
- package/dist/components/VNumberInput/VNumberInput.d.ts +114 -0
- package/dist/components/VNumberInput/VNumberInput.js +9 -0
- package/dist/components/VNumberInput/VNumberInput.js.map +1 -0
- package/dist/components/VNumberInput/VNumberInput.vue_vue_type_script_setup_true_lang.js +251 -0
- package/dist/components/VNumberInput/VNumberInput.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VNumberInput/number.d.ts +30 -0
- package/dist/components/VNumberInput/number.js +38 -0
- package/dist/components/VNumberInput/number.js.map +1 -0
- package/dist/components/VPagination/VPagination.d.ts +1 -1
- package/dist/components/VPagination/VPagination.vue_vue_type_script_setup_true_lang.js +76 -76
- package/dist/components/VProgressCircular/VProgressCircular.d.ts +2 -2
- package/dist/components/VProgressLinear/VProgressLinear.css +1 -1
- package/dist/components/VProgressLinear/VProgressLinear.d.ts +10 -7
- package/dist/components/VProgressLinear/VProgressLinear.js.map +1 -1
- package/dist/components/VProgressLinear/VProgressLinear.vue_vue_type_script_setup_true_lang.js +52 -34
- package/dist/components/VProgressLinear/VProgressLinear.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VRadio/VRadio.d.ts +8 -3
- package/dist/components/VRadio/VRadio.js.map +1 -1
- package/dist/components/VRadio/VRadio.vue_vue_type_script_setup_true_lang.js +52 -46
- package/dist/components/VRadio/VRadio.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VRating/VRating.css +2 -0
- package/dist/components/VRating/VRating.d.ts +92 -0
- package/dist/components/VRating/VRating.js +9 -0
- package/dist/components/VRating/VRating.js.map +1 -0
- package/dist/components/VRating/VRating.vue_vue_type_script_setup_true_lang.js +158 -0
- package/dist/components/VRating/VRating.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VResizable/VResizable.css +2 -0
- package/dist/components/VResizable/VResizable.d.ts +50 -0
- package/dist/components/VResizable/VResizable.js +9 -0
- package/dist/components/VResizable/VResizable.js.map +1 -0
- package/dist/components/VResizable/VResizable.vue_vue_type_script_setup_true_lang.js +225 -0
- package/dist/components/VResizable/VResizable.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VResizable/VResizablePanel.css +2 -0
- package/dist/components/VResizable/VResizablePanel.d.ts +60 -0
- package/dist/components/VResizable/VResizablePanel.js +9 -0
- package/dist/components/VResizable/VResizablePanel.js.map +1 -0
- package/dist/components/VResizable/VResizablePanel.vue_vue_type_script_setup_true_lang.js +83 -0
- package/dist/components/VResizable/VResizablePanel.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VResizable/context.d.ts +24 -0
- package/dist/components/VResizable/context.js +6 -0
- package/dist/components/VResizable/context.js.map +1 -0
- package/dist/components/VResizable/layout.d.ts +28 -0
- package/dist/components/VResizable/layout.js +41 -0
- package/dist/components/VResizable/layout.js.map +1 -0
- package/dist/components/VSelect/VSelect.css +2 -0
- package/dist/components/VSelect/VSelect.d.ts +193 -0
- package/dist/components/VSelect/VSelect.js +9 -0
- package/dist/components/VSelect/VSelect.js.map +1 -0
- package/dist/components/VSelect/VSelect.vue_vue_type_script_setup_true_lang.js +424 -0
- package/dist/components/VSelect/VSelect.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VSeparator/VSeparator.js.map +1 -1
- package/dist/components/VSeparator/VSeparator.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VSideNavigation/VSideNavigation.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/components/VSideNavigation/VSideNavigationItem.d.ts +2 -2
- package/dist/components/VSideNavigation/VSideNavigationItem.js.map +1 -1
- package/dist/components/VSideNavigation/VSideNavigationItem.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/components/VSideNavigation/VSideNavigationItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VSkeletonLoader/VSkeletonLoader.d.ts +3 -3
- package/dist/components/VSlider/VSlider.css +1 -1
- package/dist/components/VSlider/VSlider.d.ts +34 -8
- package/dist/components/VSlider/VSlider.js.map +1 -1
- package/dist/components/VSlider/VSlider.vue_vue_type_script_setup_true_lang.js +236 -215
- package/dist/components/VSlider/VSlider.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VSnackbar/VSnackbar.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/components/VSnackbar/state.js.map +1 -1
- package/dist/components/VSplitButton/VSplitButton.css +2 -0
- package/dist/components/VSplitButton/VSplitButton.d.ts +114 -0
- package/dist/components/VSplitButton/VSplitButton.js +9 -0
- package/dist/components/VSplitButton/VSplitButton.js.map +1 -0
- package/dist/components/VSplitButton/VSplitButton.vue_vue_type_script_setup_true_lang.js +148 -0
- package/dist/components/VSplitButton/VSplitButton.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VStepper/VStepper.css +2 -0
- package/dist/components/VStepper/VStepper.d.ts +73 -0
- package/dist/components/VStepper/VStepper.js +9 -0
- package/dist/components/VStepper/VStepper.js.map +1 -0
- package/dist/components/VStepper/VStepper.vue_vue_type_script_setup_true_lang.js +96 -0
- package/dist/components/VStepper/VStepper.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VSwitch/VSwitch.d.ts +8 -3
- package/dist/components/VSwitch/VSwitch.js.map +1 -1
- package/dist/components/VSwitch/VSwitch.vue_vue_type_script_setup_true_lang.js +53 -47
- package/dist/components/VSwitch/VSwitch.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VTabs/VTab.css +1 -1
- package/dist/components/VTabs/VTab.d.ts +1 -1
- package/dist/components/VTabs/VTab.js.map +1 -1
- package/dist/components/VTabs/VTab.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VTabs/VTabs.css +1 -1
- package/dist/components/VTabs/VTabs.d.ts +13 -5
- package/dist/components/VTabs/VTabs.js.map +1 -1
- package/dist/components/VTabs/VTabs.vue_vue_type_script_setup_true_lang.js +20 -20
- package/dist/components/VTabs/VTabs.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VTextarea/VTextarea.css +1 -1
- package/dist/components/VTextarea/VTextarea.d.ts +22 -2
- package/dist/components/VTextarea/VTextarea.js.map +1 -1
- package/dist/components/VTextarea/VTextarea.vue_vue_type_script_setup_true_lang.js +108 -100
- package/dist/components/VTextarea/VTextarea.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VTimeInput/VTimeInput.d.ts +27 -7
- package/dist/components/VTimeInput/VTimeInput.js.map +1 -1
- package/dist/components/VTimeInput/VTimeInput.vue_vue_type_script_setup_true_lang.js +187 -171
- package/dist/components/VTimeInput/VTimeInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VTimePicker/VTimePicker.d.ts +2 -2
- package/dist/components/VTimePicker/VTimePicker.js.map +1 -1
- package/dist/components/VTimePicker/VTimePicker.vue_vue_type_script_setup_true_lang.js +15 -15
- package/dist/components/VTimePicker/VTimePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VTimeline/VTimeline.css +2 -0
- package/dist/components/VTimeline/VTimeline.d.ts +59 -0
- package/dist/components/VTimeline/VTimeline.js +9 -0
- package/dist/components/VTimeline/VTimeline.js.map +1 -0
- package/dist/components/VTimeline/VTimeline.vue_vue_type_script_setup_true_lang.js +53 -0
- package/dist/components/VTimeline/VTimeline.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VTimeline/VTimelineItem.css +2 -0
- package/dist/components/VTimeline/VTimelineItem.d.ts +48 -0
- package/dist/components/VTimeline/VTimelineItem.js +9 -0
- package/dist/components/VTimeline/VTimelineItem.js.map +1 -0
- package/dist/components/VTimeline/VTimelineItem.vue_vue_type_script_setup_true_lang.js +70 -0
- package/dist/components/VTimeline/VTimelineItem.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VTimeline/context.d.ts +11 -0
- package/dist/components/VTimeline/context.js +6 -0
- package/dist/components/VTimeline/context.js.map +1 -0
- package/dist/components/VTimeline/datetime.d.ts +8 -0
- package/dist/components/VTimeline/datetime.js +36 -0
- package/dist/components/VTimeline/datetime.js.map +1 -0
- package/dist/components/VToast/VToast.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/components/VToast/VToaster.vue_vue_type_script_setup_true_lang.js +12 -12
- package/dist/components/VToggle/VToggle.d.ts +4 -4
- package/dist/components/VToggle/VToggleItem.d.ts +1 -1
- package/dist/components/VTooltip/VTooltip.d.ts +8 -2
- package/dist/components/VTooltip/VTooltip.js.map +1 -1
- package/dist/components/VTooltip/VTooltip.vue_vue_type_script_setup_true_lang.js +45 -43
- package/dist/components/VTooltip/VTooltip.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VTreeView/VTreeView.css +2 -0
- package/dist/components/VTreeView/VTreeView.d.ts +112 -0
- package/dist/components/VTreeView/VTreeView.js +9 -0
- package/dist/components/VTreeView/VTreeView.js.map +1 -0
- package/dist/components/VTreeView/VTreeView.vue_vue_type_script_setup_true_lang.js +321 -0
- package/dist/components/VTreeView/VTreeView.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VTypography/VTypography.d.ts +1 -1
- package/dist/components/VVirtualList/VVirtualList.css +2 -0
- package/dist/components/VVirtualList/VVirtualList.d.ts +78 -0
- package/dist/components/VVirtualList/VVirtualList.js +9 -0
- package/dist/components/VVirtualList/VVirtualList.js.map +1 -0
- package/dist/components/VVirtualList/VVirtualList.vue_vue_type_script_setup_true_lang.js +114 -0
- package/dist/components/VVirtualList/VVirtualList.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/composables/useChoice.d.ts +28 -0
- package/dist/composables/useChoice.js +28 -0
- package/dist/composables/useChoice.js.map +1 -0
- package/dist/composables/useDebouncedSearch.d.ts +17 -0
- package/dist/composables/useDebouncedSearch.js +18 -0
- package/dist/composables/useDebouncedSearch.js.map +1 -0
- package/dist/composables/useEscapeDismiss.d.ts +8 -0
- package/dist/composables/useEscapeDismiss.js +16 -0
- package/dist/composables/useEscapeDismiss.js.map +1 -0
- package/dist/composables/useFieldIds.d.ts +2 -1
- package/dist/composables/useFieldIds.js +7 -6
- package/dist/composables/useFieldIds.js.map +1 -1
- package/dist/composables/useFieldPanel.d.ts +1 -0
- package/dist/composables/useFieldPanel.js +52 -42
- package/dist/composables/useFieldPanel.js.map +1 -1
- package/dist/composables/useFileField.d.ts +1 -3
- package/dist/composables/useFileField.js +48 -50
- package/dist/composables/useFileField.js.map +1 -1
- package/dist/composables/useHotkeyListener.d.ts +17 -0
- package/dist/composables/useHotkeyListener.js +26 -0
- package/dist/composables/useHotkeyListener.js.map +1 -0
- package/dist/composables/useIconClickHandlers.d.ts +2 -10
- package/dist/composables/useIconClickHandlers.js +1 -1
- package/dist/composables/useIconClickHandlers.js.map +1 -1
- package/dist/{components/VCombobox/infiniteScroll.d.ts → composables/useInfiniteScroll.d.ts} +6 -0
- package/dist/{components/VCombobox/infiniteScroll.js → composables/useInfiniteScroll.js} +7 -7
- package/dist/composables/useInfiniteScroll.js.map +1 -0
- package/dist/composables/useListbox.d.ts +132 -0
- package/dist/composables/useListbox.js +227 -0
- package/dist/composables/useListbox.js.map +1 -0
- package/dist/composables/useModalDialog.d.ts +28 -0
- package/dist/composables/useModalDialog.js +60 -0
- package/dist/composables/useModalDialog.js.map +1 -0
- package/dist/composables/useRootAttrs.d.ts +2 -3
- package/dist/composables/useRootAttrs.js.map +1 -1
- package/dist/composables/useVirtualList.d.ts +46 -0
- package/dist/composables/useVirtualList.js +145 -0
- package/dist/composables/useVirtualList.js.map +1 -0
- package/dist/i18n/en.js +50 -0
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/fr.js +50 -0
- package/dist/i18n/fr.js.map +1 -1
- package/dist/i18n/types.d.ts +103 -2
- package/dist/icons.js +45 -37
- package/dist/index.d.ts +49 -3
- package/dist/index.js +80 -56
- package/dist/styles.css +1 -1
- package/dist/tokens/index.d.ts +43 -0
- package/dist/tokens/semantic.d.ts +42 -0
- package/dist/tokens/semantic.js +43 -1
- package/dist/tokens/semantic.js.map +1 -1
- package/dist/tokens/themes/dark.d.ts +1 -0
- package/dist/tokens/themes/dark.js +1 -0
- package/dist/tokens/themes/dark.js.map +1 -1
- package/dist/tokens.json +215 -1
- package/dist/types.d.ts +57 -4
- package/dist/utils/arrowNav.js.map +1 -1
- package/dist/utils/attrs.d.ts +9 -0
- package/dist/utils/attrs.js +14 -0
- package/dist/utils/attrs.js.map +1 -0
- package/dist/utils/date.d.ts +1 -0
- package/dist/utils/date.js +2 -2
- package/dist/utils/date.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/VCombobox/VComboboxGroup.css +0 -2
- package/dist/components/VCombobox/VComboboxGroup.d.ts +0 -17
- package/dist/components/VCombobox/VComboboxGroup.js +0 -9
- package/dist/components/VCombobox/VComboboxGroup.js.map +0 -1
- package/dist/components/VCombobox/VComboboxGroup.vue_vue_type_script_setup_true_lang.js +0 -21
- package/dist/components/VCombobox/VComboboxGroup.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/components/VCombobox/VComboboxOption.css +0 -2
- package/dist/components/VCombobox/VComboboxOption.js +0 -9
- package/dist/components/VCombobox/VComboboxOption.js.map +0 -1
- package/dist/components/VCombobox/VComboboxOption.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/components/VCombobox/VComboboxSeparator.css +0 -2
- package/dist/components/VCombobox/VComboboxSeparator.js +0 -9
- package/dist/components/VCombobox/VComboboxSeparator.js.map +0 -1
- package/dist/components/VCombobox/VComboboxSeparator.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/components/VCombobox/infiniteScroll.js.map +0 -1
- /package/dist/components/{VCombobox/VComboboxSeparator.d.ts → VCheckbox/VCheckMark.d.ts} +0 -0
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { clamp as e } from "../utils/number.js";
|
|
2
|
+
import { useVirtualList as t } from "./useVirtualList.js";
|
|
3
|
+
import { computed as n, reactive as r, ref as i, watch as a, watchEffect as o } from "vue";
|
|
4
|
+
//#region src/composables/useListbox.ts
|
|
5
|
+
var s = (e) => "options" in e, c = (e) => "separator" in e;
|
|
6
|
+
function l(e, t) {
|
|
7
|
+
return t ? Array.isArray(e) ? e : [] : !Array.isArray(e) && e !== "" ? [e] : [];
|
|
8
|
+
}
|
|
9
|
+
var u = {
|
|
10
|
+
sm: 32,
|
|
11
|
+
md: 40,
|
|
12
|
+
lg: 48
|
|
13
|
+
};
|
|
14
|
+
function d(l) {
|
|
15
|
+
let d = n(() => l.items().flatMap((e) => c(e) ? [] : s(e) ? e.options : [e])), f = n(() => l.filter?.(d.value) ?? d.value), p = n(() => new Set(l.selected())), m = r(/* @__PURE__ */ new Map());
|
|
16
|
+
o(() => {
|
|
17
|
+
let e = p.value;
|
|
18
|
+
for (let t of d.value) e.has(t.value) && m.set(t.value, t);
|
|
19
|
+
for (let t of m.keys()) e.has(t) || m.delete(t);
|
|
20
|
+
});
|
|
21
|
+
let h = n(() => {
|
|
22
|
+
let e = /* @__PURE__ */ new Map();
|
|
23
|
+
for (let t of d.value) e.has(t.value) || e.set(t.value, t);
|
|
24
|
+
return e;
|
|
25
|
+
});
|
|
26
|
+
function g(e) {
|
|
27
|
+
return h.value.get(e) ?? m.get(e);
|
|
28
|
+
}
|
|
29
|
+
let _ = (e) => g(e)?.label ?? String(e), v = (e) => void m.set(e.value, e), y = i(-1), b = n(() => new Map(d.value.map((e, t) => [e, t]))), x = (e) => {
|
|
30
|
+
let t = f.value[e];
|
|
31
|
+
return `${l.id}-option-${t ? b.value.get(t) : e}`;
|
|
32
|
+
}, S = () => f.value.findIndex((e) => !e.disabled);
|
|
33
|
+
function C() {
|
|
34
|
+
y.value = S();
|
|
35
|
+
}
|
|
36
|
+
function w() {
|
|
37
|
+
let e = f.value, t = e.length - 1;
|
|
38
|
+
for (; t >= 0 && e[t]?.disabled;) t--;
|
|
39
|
+
y.value = t;
|
|
40
|
+
}
|
|
41
|
+
function T() {
|
|
42
|
+
let e = f.value.findIndex((e) => !e.disabled && p.value.has(e.value));
|
|
43
|
+
y.value = e >= 0 ? e : S();
|
|
44
|
+
}
|
|
45
|
+
function E(e) {
|
|
46
|
+
let t = f.value;
|
|
47
|
+
if (t.length === 0) return;
|
|
48
|
+
let n = y.value < 0 && e < 0 ? 0 : y.value;
|
|
49
|
+
for (let r = 0; r < t.length && (n = (n + e + t.length) % t.length, t[n]?.disabled); r++);
|
|
50
|
+
y.value = n;
|
|
51
|
+
}
|
|
52
|
+
function D(t) {
|
|
53
|
+
let n = f.value, r = e(y.value + t, 0, n.length - 1), i = Math.sign(t);
|
|
54
|
+
for (let e of [i, -i]) for (let t = r; t >= 0 && t < n.length; t += e) if (!n[t]?.disabled) {
|
|
55
|
+
y.value = t;
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function O(e) {
|
|
60
|
+
e.option.disabled || (y.value = e.index);
|
|
61
|
+
}
|
|
62
|
+
a(f, (e) => {
|
|
63
|
+
l.open() && (y.value < 0 || y.value >= e.length) && C();
|
|
64
|
+
});
|
|
65
|
+
let k = n(() => {
|
|
66
|
+
let e = new Set(f.value), t = 0, n = (n, r) => e.has(n) ? {
|
|
67
|
+
kind: "option",
|
|
68
|
+
key: `option:${r}`,
|
|
69
|
+
option: n,
|
|
70
|
+
index: t++
|
|
71
|
+
} : null, r = [], i = null;
|
|
72
|
+
for (let [e, t] of l.items().entries()) {
|
|
73
|
+
if (c(t)) {
|
|
74
|
+
r.length > 0 && (i = `sep:${e}`);
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
let a;
|
|
78
|
+
if (s(t)) {
|
|
79
|
+
let r = t.options.map((t, r) => n(t, `${e}.${r}`)).filter((e) => e !== null);
|
|
80
|
+
a = r.length > 0 ? {
|
|
81
|
+
kind: "group",
|
|
82
|
+
key: `group:${e}`,
|
|
83
|
+
id: `${l.id}-group-${e}`,
|
|
84
|
+
label: t.label,
|
|
85
|
+
options: r
|
|
86
|
+
} : null;
|
|
87
|
+
} else a = n(t, String(e));
|
|
88
|
+
a && (i !== null && (r.push({
|
|
89
|
+
kind: "separator",
|
|
90
|
+
key: i
|
|
91
|
+
}), i = null), r.push(a));
|
|
92
|
+
}
|
|
93
|
+
return r;
|
|
94
|
+
}), A = n(() => {
|
|
95
|
+
let e = [], t = /* @__PURE__ */ new Map(), n = [], r = k.value.filter((e) => e.kind === "option").length, i = 0;
|
|
96
|
+
for (let a of k.value) if (a.kind === "separator") e.push(a);
|
|
97
|
+
else if (a.kind === "option") n[a.index] = e.length, e.push({
|
|
98
|
+
...a,
|
|
99
|
+
set: r,
|
|
100
|
+
position: ++i
|
|
101
|
+
});
|
|
102
|
+
else {
|
|
103
|
+
t.set(a.key, a.label), e.push({
|
|
104
|
+
kind: "heading",
|
|
105
|
+
key: `heading:${a.key}`,
|
|
106
|
+
id: a.id,
|
|
107
|
+
label: a.label,
|
|
108
|
+
group: a.key
|
|
109
|
+
});
|
|
110
|
+
for (let [t, r] of a.options.entries()) n[r.index] = e.length, e.push({
|
|
111
|
+
...r,
|
|
112
|
+
group: a.key,
|
|
113
|
+
set: a.options.length,
|
|
114
|
+
position: t + 1
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
rows: e,
|
|
119
|
+
labels: t,
|
|
120
|
+
rowOfOption: n
|
|
121
|
+
};
|
|
122
|
+
}), j = t({
|
|
123
|
+
scrollEl: n(() => l.virtual() ? l.panelEl() : null),
|
|
124
|
+
count: () => A.value.rows.length,
|
|
125
|
+
key: (e) => A.value.rows[e]?.key,
|
|
126
|
+
itemSize: () => u[l.size()] - (l.compact() ? 4 : 0),
|
|
127
|
+
overscan: () => 5,
|
|
128
|
+
initialCount: () => 10,
|
|
129
|
+
pinned: () => {
|
|
130
|
+
let e = A.value.rowOfOption[y.value];
|
|
131
|
+
return e === void 0 ? [] : [e];
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
function M(e, t) {
|
|
135
|
+
let n = e.index === y.value, r = p.value.has(e.option.value), i = l.virtual() ? {
|
|
136
|
+
"aria-setsize": l.hasMore?.() ? -1 : e.set,
|
|
137
|
+
"aria-posinset": e.position
|
|
138
|
+
} : {};
|
|
139
|
+
return {
|
|
140
|
+
...e,
|
|
141
|
+
at: t,
|
|
142
|
+
row: {
|
|
143
|
+
id: x(e.index),
|
|
144
|
+
icon: e.option.icon,
|
|
145
|
+
active: n,
|
|
146
|
+
selected: r,
|
|
147
|
+
disabled: e.option.disabled,
|
|
148
|
+
...i
|
|
149
|
+
},
|
|
150
|
+
slot: {
|
|
151
|
+
option: e.option,
|
|
152
|
+
index: e.index,
|
|
153
|
+
active: n,
|
|
154
|
+
selected: r
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
let N = n(() => {
|
|
159
|
+
let { rows: e, labels: t } = A.value, n = l.virtual() ? j.segments.value : e.map((e, t) => ({
|
|
160
|
+
type: "row",
|
|
161
|
+
index: t
|
|
162
|
+
})), r = (t) => {
|
|
163
|
+
let n = t?.type === "row" ? e[t.index] : void 0;
|
|
164
|
+
return n && n.kind !== "separator" ? n.group : void 0;
|
|
165
|
+
}, i = [], a;
|
|
166
|
+
for (let [o, s] of n.entries()) {
|
|
167
|
+
let c, l;
|
|
168
|
+
if (s.type === "spacer") {
|
|
169
|
+
c = {
|
|
170
|
+
kind: "spacer",
|
|
171
|
+
key: s.key,
|
|
172
|
+
size: s.size
|
|
173
|
+
};
|
|
174
|
+
let e = r(n[o - 1]);
|
|
175
|
+
l = e === r(n[o + 1]) ? e : void 0;
|
|
176
|
+
} else {
|
|
177
|
+
let t = e[s.index];
|
|
178
|
+
c = t.kind === "option" ? M(t, s.index) : {
|
|
179
|
+
...t,
|
|
180
|
+
at: s.index
|
|
181
|
+
}, l = r(s);
|
|
182
|
+
}
|
|
183
|
+
if (l === void 0) {
|
|
184
|
+
a = void 0, i.push(c);
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
a?.key !== l && (a = {
|
|
188
|
+
kind: "group",
|
|
189
|
+
key: l,
|
|
190
|
+
label: t.get(l),
|
|
191
|
+
children: []
|
|
192
|
+
}, i.push(a)), c.kind === "heading" && (a.labelId = c.id), a.children.push(c);
|
|
193
|
+
}
|
|
194
|
+
return i;
|
|
195
|
+
});
|
|
196
|
+
return a(y, (e) => {
|
|
197
|
+
if (!(e < 0)) {
|
|
198
|
+
if (l.virtual()) {
|
|
199
|
+
let t = A.value.rowOfOption[e];
|
|
200
|
+
t !== void 0 && j.scrollToIndex(t);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
document.getElementById(x(e))?.scrollIntoView?.({ block: "nearest" });
|
|
204
|
+
}
|
|
205
|
+
}, { flush: "post" }), {
|
|
206
|
+
allOptions: d,
|
|
207
|
+
visible: f,
|
|
208
|
+
selectedSet: p,
|
|
209
|
+
optionOf: g,
|
|
210
|
+
labelOf: _,
|
|
211
|
+
remember: v,
|
|
212
|
+
activeIndex: y,
|
|
213
|
+
optionId: x,
|
|
214
|
+
highlightFirst: C,
|
|
215
|
+
highlightLast: w,
|
|
216
|
+
highlightSelected: T,
|
|
217
|
+
move: E,
|
|
218
|
+
page: D,
|
|
219
|
+
hover: O,
|
|
220
|
+
blocks: N,
|
|
221
|
+
measureRow: j.measure
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
//#endregion
|
|
225
|
+
export { l as selectionOf, d as useListbox };
|
|
226
|
+
|
|
227
|
+
//# sourceMappingURL=useListbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useListbox.js","names":[],"sources":["../../src/composables/useListbox.ts"],"sourcesContent":["// @keyboard @a11y\n/**\n * Model a listbox whose DOM focus stays on its field, for VCombobox and VSelect: the field names\n * the highlighted option through aria-activedescendant and moves it by hand, and the panel renders\n * `blocks`. Groups and separators exist for the eye alone; the keyboard counts through the flat\n * list of options and therefore never stops on one.\n */\nimport { computed, reactive, ref, watch, watchEffect, type ComputedRef, type Ref } from 'vue'\n\nimport type { IconSource } from '../components/VIcon/types'\nimport type {\n ItemValue,\n ListboxGroup,\n ListboxItem,\n ListboxOption,\n ListboxOptionSlotProps,\n ListboxSeparator,\n} from '../types'\nimport { clamp } from '../utils/number'\nimport { useVirtualList, type VirtualList, type VirtualSegment } from './useVirtualList'\n\nconst isListboxGroup = (item: ListboxItem): item is ListboxGroup => 'options' in item\nconst isListboxSeparator = (item: ListboxItem): item is ListboxSeparator => 'separator' in item\n\n/**\n * The chosen values as a list, whatever the model holds. An empty string is what an emptied\n * single field says, and it is not a value. A NUMBER is a value even at zero; hence the test on\n * the empty string alone rather than on falsiness, which would drop the option keyed `0`.\n */\nexport function selectionOf(value: ItemValue | ItemValue[], multiple: boolean): ItemValue[] {\n if (multiple) return Array.isArray(value) ? value : []\n return !Array.isArray(value) && value !== '' ? [value] : []\n}\n\ntype ListboxSize = 'sm' | 'md' | 'lg'\n\nexport interface ListboxOptions {\n /** What the list offers, as the consumer gave it. */\n items: () => ListboxItem[]\n /**\n * Narrows the flattened options, read inside a computed so it may follow reactive state. Left\n * out, every option stays.\n */\n filter?: (options: ListboxOption[]) => ListboxOption[]\n /** The chosen values. */\n selected: () => ItemValue[]\n /** Whether the panel is showing; the highlight is kept on a valid option only while it is. */\n open: () => boolean\n /** The panel's id, and the prefix of every option's and heading's id. */\n id: string\n /** The scrolling panel, which the virtual mode windows. */\n panelEl: () => HTMLElement | null\n /** Renders only the rows near the visible part of the panel. */\n virtual: () => boolean\n /** More pages are coming, so the last block's size is unknown. */\n hasMore?: () => boolean\n size: () => ListboxSize\n compact: () => boolean\n}\n\n/** An option the panel renders, with its index in the visible options. */\nexport interface ListboxRenderedOption {\n kind: 'option'\n key: string\n option: ListboxOption\n index: number\n}\n\ntype RenderedNode =\n | ListboxRenderedOption\n | { kind: 'group'; key: string; id: string; label: string; options: ListboxRenderedOption[] }\n | { kind: 'separator'; key: string }\n\n/**\n * The panel as one flat sequence of rows, the unit the virtual mode windows: a block's name is a\n * row of its own, above its options. Each row knows its block, so the rows rendered can be\n * gathered back into their groups. `set` and `position` are the option's place in its block, or\n * among the options outside any block.\n */\ntype FlatOption = ListboxRenderedOption & { group?: string; set: number; position: number }\ntype FlatRow =\n | FlatOption\n | { kind: 'heading'; key: string; id: string; label: string; group: string }\n | { kind: 'separator'; key: string }\n\n/**\n * A rendered option with its state worked out, once per row: `row` is what the option element\n * takes, `slot` what the `#option` slot receives, and both read the same two answers. `at` is\n * the row's place in the flat sequence, which the virtual mode measures it under.\n */\nexport type ListboxOptionRow = FlatOption & {\n at: number\n row: {\n id: string\n icon?: IconSource\n active: boolean\n selected: boolean\n disabled?: boolean\n 'aria-setsize'?: number\n 'aria-posinset'?: number\n }\n slot: ListboxOptionSlotProps\n}\n\nexport type ListboxRow =\n | ListboxOptionRow\n | { kind: 'heading'; key: string; id: string; label: string; at: number }\n | { kind: 'separator'; key: string; at: number }\n | { kind: 'spacer'; key: string; size: number }\n\n/** What the panel renders: rows, and blocks of rows gathered under their name. */\nexport type ListboxBlock =\n | ListboxRow\n | { kind: 'group'; key: string; label: string; labelId?: string; children: ListboxRow[] }\n\n// Only a starting guess for the virtual mode, every row being measured once rendered: the\n// height of an option at each size, 4px less when compact, as the control heights go.\nconst OPTION_HEIGHT: Record<ListboxSize, number> = { sm: 32, md: 40, lg: 48 }\n\nexport interface Listbox {\n /** Every option, the blocks unwrapped and the separators dropped, in the order given. */\n allOptions: ComputedRef<ListboxOption[]>\n /** The options left by the filter: what the keyboard counts through. */\n visible: ComputedRef<ListboxOption[]>\n /** The selection as a set, so that asking \"is this one chosen?\" costs nothing. */\n selectedSet: ComputedRef<Set<ItemValue>>\n /** The option holding a value, found among the options or in the memory of chosen ones. */\n optionOf: (value: ItemValue) => ListboxOption | undefined\n /** The label of a value, or the value itself spelled out when no option holds it. */\n labelOf: (value: ItemValue) => string\n /** Keeps an option just chosen in memory, before the parent passes the value back down. */\n remember: (option: ListboxOption) => void\n /** The index of the highlighted option among `visible`, or -1. */\n activeIndex: Ref<number>\n /** The id of the option at an index of `visible`. */\n optionId: (index: number) => string\n /** Highlights the first option that can be chosen, or nothing. */\n highlightFirst: () => void\n /** Highlights the last option that can be chosen, or nothing. */\n highlightLast: () => void\n /** Highlights the first chosen option, or the first that can be chosen. */\n highlightSelected: () => void\n /** Moves the highlight by `delta` options, wrapping around and skipping disabled ones. */\n move: (delta: number) => void\n /**\n * Moves the highlight by `delta` options without wrapping, the step of Page Up and Page Down:\n * it stops at the first or last option that can be chosen.\n */\n page: (delta: number) => void\n /** Highlights the option under the pointer. */\n hover: (row: ListboxRenderedOption) => void\n /** What the panel renders. */\n blocks: ComputedRef<ListboxBlock[]>\n /** Measures a rendered row, in the virtual mode. */\n measureRow: VirtualList['measure']\n}\n\nexport function useListbox(options: ListboxOptions): Listbox {\n // The ONE reading of the items the rest of the module does: the filtering, the memory of what\n // was chosen, the labels and the paging all ignore the hierarchy entirely.\n const allOptions = computed<ListboxOption[]>(() =>\n options.items().flatMap((item) => {\n if (isListboxSeparator(item)) return []\n return isListboxGroup(item) ? item.options : [item]\n }),\n )\n\n const visible = computed(() => options.filter?.(allOptions.value) ?? allOptions.value)\n\n const selectedSet = computed(() => new Set(options.selected()))\n\n // With a source that answers over the network, the options only ever hold the latest results,\n // and something already chosen is usually absent from them; without this, a chip would show a\n // raw identifier instead of a name. It is kept up to date by an effect rather than by watching\n // the options, because the effect tracks the ITERATION and therefore also notices a page\n // appended in place.\n const optionCache = reactive(new Map<ItemValue, ListboxOption>())\n watchEffect(() => {\n const wanted = selectedSet.value\n for (const option of allOptions.value) {\n if (wanted.has(option.value)) optionCache.set(option.value, option)\n }\n // Without this the memory would grow with every value chosen during the session rather than\n // with the current selection.\n for (const value of optionCache.keys()) if (!wanted.has(value)) optionCache.delete(value)\n })\n\n // A lookup built once per list rather than searched each time: an option is looked up several\n // times per chip and per render, so a linear search would cost chips times options on every\n // keystroke.\n const optionsByValue = computed(() => {\n const map = new Map<ItemValue, ListboxOption>()\n for (const option of allOptions.value) if (!map.has(option.value)) map.set(option.value, option)\n return map\n })\n\n /*\n * An option coming from the memory is a reactive PROXY, since making the map reactive converts\n * the objects inside it. Compare options by their value and never by identity, or the two forms\n * of the same option will not match.\n */\n function optionOf(value: ItemValue) {\n return optionsByValue.value.get(value) ?? optionCache.get(value)\n }\n\n const labelOf = (value: ItemValue) => optionOf(value)?.label ?? String(value)\n\n const remember = (option: ListboxOption) => void optionCache.set(option.value, option)\n\n const activeIndex = ref(-1)\n\n // @a11y\n // An option's id follows the OPTION, from its place among all the options, and never its place\n // in the filtered list: a screen reader announces the current option when\n // `aria-activedescendant` changes, and a positional id would keep the same value while the\n // filter slides another option under the highlight, which then goes unannounced.\n const sourceIndex = computed(() => new Map(allOptions.value.map((option, i) => [option, i])))\n const optionId = (index: number) => {\n const option = visible.value[index]\n return `${options.id}-option-${option ? sourceIndex.value.get(option) : index}`\n }\n\n const firstEnabled = () => visible.value.findIndex((o) => !o.disabled)\n\n function highlightFirst() {\n activeIndex.value = firstEnabled()\n }\n\n function highlightLast() {\n const list = visible.value\n let i = list.length - 1\n while (i >= 0 && list[i]?.disabled) i--\n activeIndex.value = i\n }\n\n function highlightSelected() {\n const chosen = visible.value.findIndex((o) => !o.disabled && selectedSet.value.has(o.value))\n activeIndex.value = chosen >= 0 ? chosen : firstEnabled()\n }\n\n // @keyboard\n function move(delta: number) {\n const list = visible.value\n if (list.length === 0) return\n // From \"nothing highlighted\" the first step lands on an END of the list: starting at -1,\n // a step back would stop on the second-to-last option.\n let i = activeIndex.value < 0 && delta < 0 ? 0 : activeIndex.value\n for (let step = 0; step < list.length; step++) {\n i = (i + delta + list.length) % list.length\n if (!list[i]?.disabled) break\n }\n activeIndex.value = i\n }\n\n // @keyboard\n function page(delta: number) {\n const list = visible.value\n const target = clamp(activeIndex.value + delta, 0, list.length - 1)\n const step = Math.sign(delta)\n // Past a disabled option in the direction of travel, then back if the end was disabled too.\n for (const dir of [step, -step]) {\n for (let i = target; i >= 0 && i < list.length; i += dir) {\n if (!list[i]?.disabled) {\n activeIndex.value = i\n return\n }\n }\n }\n }\n\n function hover(row: ListboxRenderedOption) {\n if (!row.option.disabled) activeIndex.value = row.index\n }\n\n // While the panel is open there must always be a valid option highlighted. It is moved back to\n // the first one whenever the highlighted one has fallen out of the list or there was none at\n // all; without that second case, a search that passed through \"no result\" would leave nothing\n // highlighted, and Enter would not choose the single result that came back.\n watch(visible, (list) => {\n if (!options.open()) return\n if (activeIndex.value < 0 || activeIndex.value >= list.length) highlightFirst()\n })\n\n // Nothing here is keyed by VALUE. Two options may share one (a consumer's duplicate, or `1`\n // beside `'1'`, which a template literal spells the same), and a value-keyed index hands both\n // the same position, so both light up as active and Vue patches two rows under one key.\n const rendered = computed<RenderedNode[]>(() => {\n const kept = new Set(visible.value)\n let next = 0\n\n const entryOf = (option: ListboxOption, key: string): ListboxRenderedOption | null => {\n if (!kept.has(option)) return null\n return { kind: 'option', key: `option:${key}`, option, index: next++ }\n }\n\n const nodes: RenderedNode[] = []\n // A separator is held back and only drawn once something has come before it and something\n // comes after it. That single rule covers all three ways the filtering can strand one: at\n // the top of the list, at the bottom, and two in a row.\n let pendingSeparator: string | null = null\n\n for (const [i, item] of options.items().entries()) {\n if (isListboxSeparator(item)) {\n if (nodes.length > 0) pendingSeparator = `sep:${i}`\n continue\n }\n\n let node: RenderedNode | null\n if (isListboxGroup(item)) {\n const entries = item.options\n .map((option, j) => entryOf(option, `${i}.${j}`))\n .filter((entry): entry is ListboxRenderedOption => entry !== null)\n // A block none of whose options survived is dropped entirely, its name included:\n // a heading over nothing is worse than no heading.\n node =\n entries.length > 0\n ? {\n kind: 'group',\n key: `group:${i}`,\n id: `${options.id}-group-${i}`,\n label: item.label,\n options: entries,\n }\n : null\n } else {\n node = entryOf(item, String(i))\n }\n if (!node) continue\n\n if (pendingSeparator !== null) {\n nodes.push({ kind: 'separator', key: pendingSeparator })\n pendingSeparator = null\n }\n nodes.push(node)\n }\n\n return nodes\n })\n\n const flat = computed(() => {\n const rows: FlatRow[] = []\n const labels = new Map<string, string>()\n // Indexed by the option's place in `visible`: where the keyboard's highlight sits in the rows.\n const rowOfOption: number[] = []\n const loose = rendered.value.filter((node) => node.kind === 'option').length\n let looseSeen = 0\n for (const node of rendered.value) {\n if (node.kind === 'separator') rows.push(node)\n else if (node.kind === 'option') {\n rowOfOption[node.index] = rows.length\n rows.push({ ...node, set: loose, position: ++looseSeen })\n } else {\n labels.set(node.key, node.label)\n rows.push({\n kind: 'heading',\n key: `heading:${node.key}`,\n id: node.id,\n label: node.label,\n group: node.key,\n })\n for (const [j, option] of node.options.entries()) {\n rowOfOption[option.index] = rows.length\n rows.push({ ...option, group: node.key, set: node.options.length, position: j + 1 })\n }\n }\n }\n return { rows, labels, rowOfOption }\n })\n\n // @a11y\n // The highlighted row stays rendered wherever the panel is scrolled: `aria-activedescendant`\n // must name an element that exists.\n const virtualList = useVirtualList({\n scrollEl: computed(() => (options.virtual() ? options.panelEl() : null)),\n count: () => flat.value.rows.length,\n key: (index) => flat.value.rows[index]?.key,\n itemSize: () => OPTION_HEIGHT[options.size()] - (options.compact() ? 4 : 0),\n overscan: () => 5,\n initialCount: () => 10,\n pinned: () => {\n const row = flat.value.rowOfOption[activeIndex.value]\n return row === undefined ? [] : [row]\n },\n })\n\n function withState(entry: FlatOption, at: number): ListboxOptionRow {\n const active = entry.index === activeIndex.value\n const selected = selectedSet.value.has(entry.option.value)\n // @a11y\n // Only some options exist in the virtual mode, so each one says where it stands; the last\n // block may still grow while pages are coming.\n const placed = options.virtual()\n ? { 'aria-setsize': options.hasMore?.() ? -1 : entry.set, 'aria-posinset': entry.position }\n : {}\n return {\n ...entry,\n at,\n row: {\n id: optionId(entry.index),\n icon: entry.option.icon,\n active,\n selected,\n disabled: entry.option.disabled,\n ...placed,\n },\n slot: { option: entry.option, index: entry.index, active, selected },\n }\n }\n\n // The rows of the window and the space standing for the others, gathered back into their\n // blocks. Kept apart from `flat` on purpose: the highlight moves on every arrow key, and only\n // this pass over the rendered rows follows it; the filtering and the grouping stay where they\n // are.\n const blocks = computed<ListboxBlock[]>(() => {\n const { rows, labels } = flat.value\n const segments: VirtualSegment[] = options.virtual()\n ? virtualList.segments.value\n : rows.map((_, index) => ({ type: 'row', index }))\n const groupAt = (segment: VirtualSegment | undefined) => {\n const row = segment?.type === 'row' ? rows[segment.index] : undefined\n return row && row.kind !== 'separator' ? row.group : undefined\n }\n\n const out: ListboxBlock[] = []\n let open: Extract<ListboxBlock, { kind: 'group' }> | undefined\n for (const [k, segment] of segments.entries()) {\n let block: ListboxRow\n let group: string | undefined\n if (segment.type === 'spacer') {\n block = { kind: 'spacer', key: segment.key, size: segment.size }\n // Between two rows of one block, the space stands for rows of that block.\n const before = groupAt(segments[k - 1])\n group = before === groupAt(segments[k + 1]) ? before : undefined\n } else {\n const row = rows[segment.index]!\n block =\n row.kind === 'option' ? withState(row, segment.index) : { ...row, at: segment.index }\n group = groupAt(segment)\n }\n if (group === undefined) {\n open = undefined\n out.push(block)\n continue\n }\n if (open?.key !== group) {\n open = { kind: 'group', key: group, label: labels.get(group)!, children: [] }\n out.push(open)\n }\n if (block.kind === 'heading') open.labelId = block.id\n open.children.push(block)\n }\n return out\n })\n\n // @a11y\n // Since the focus never leaves the field, the browser has no reason to scroll the highlighted\n // option into view. It is brought into view by hand instead, and asked for the SMALLEST\n // movement that reveals it, so an option already visible does not make the panel jump.\n watch(\n activeIndex,\n (index) => {\n if (index < 0) return\n if (options.virtual()) {\n const row = flat.value.rowOfOption[index]\n if (row !== undefined) void virtualList.scrollToIndex(row)\n return\n }\n // Called optionally: the unit-test environment implements no scrolling at all.\n document.getElementById(optionId(index))?.scrollIntoView?.({ block: 'nearest' })\n },\n { flush: 'post' },\n )\n\n return {\n allOptions,\n visible,\n selectedSet,\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: virtualList.measure,\n }\n}\n"],"mappings":";;;;AAqBA,IAAM,KAAkB,MAA4C,aAAa,GAC3E,KAAsB,MAAgD,eAAe;AAO3F,SAAgB,EAAY,GAAgC,GAAgC;CAE1F,OADI,IAAiB,MAAM,QAAQ,CAAK,IAAI,IAAQ,CAAC,IAC9C,CAAC,MAAM,QAAQ,CAAK,KAAK,MAAU,KAAK,CAAC,CAAK,IAAI,CAAC;AAC5D;AAqFA,IAAM,IAA6C;CAAE,IAAI;CAAI,IAAI;CAAI,IAAI;AAAG;AAwC5E,SAAgB,EAAW,GAAkC;CAG3D,IAAM,IAAa,QACjB,EAAQ,MAAM,CAAC,CAAC,SAAS,MACnB,EAAmB,CAAI,IAAU,C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,KAAA,KAAW,EAAiB,cAAc,CAAG;IACzD;GACF;GAEA,SAAS,eAAe,EAAS,CAAK,CAAC,CAAC,EAAE,iBAAiB,EAAE,OAAO,UAAU,CAAC;EAF/E;CAGF,GACA,EAAE,OAAO,OAAO,CAClB,GAEO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YAAY,EAAY;CAC1B;AACF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* The bridge between a `v-model:open` and a native modal `<dialog>`, shared by VDialog and
|
|
4
|
+
* VDrawer. Native showModal supplies top-layer placement and modal focus; this bridges the model
|
|
5
|
+
* to the imperative open and close, and provides guarded dismissal where closedBy is absent.
|
|
6
|
+
*
|
|
7
|
+
* The element is rendered only while it is needed. With `exitTransition`, it outlives its
|
|
8
|
+
* closing until the transitions it runs on the way out have finished.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useModalDialog(open: Ref<boolean>, options: {
|
|
11
|
+
persistentBackdrop: () => boolean;
|
|
12
|
+
persistentEscape: () => boolean;
|
|
13
|
+
exitTransition?: boolean;
|
|
14
|
+
}): {
|
|
15
|
+
dialogEl: Ref<HTMLDialogElement | null, HTMLDialogElement | null>;
|
|
16
|
+
rendered: import('vue').ComputedRef<boolean>;
|
|
17
|
+
rootAttrs: import('vue').ComputedRef<{
|
|
18
|
+
closedby: string;
|
|
19
|
+
class?: import('vue').ClassValue;
|
|
20
|
+
style?: import('vue').StyleValue;
|
|
21
|
+
}>;
|
|
22
|
+
show: () => Promise<void>;
|
|
23
|
+
close: () => void;
|
|
24
|
+
onClose: (event: Event) => void;
|
|
25
|
+
onCancel: (event: Event) => void;
|
|
26
|
+
onPointerdown: (event: PointerEvent) => void;
|
|
27
|
+
onBackdropClick: (event: MouseEvent) => void;
|
|
28
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { computed as e, nextTick as t, onBeforeUnmount as n, ref as r, useAttrs as i, watch as a } from "vue";
|
|
2
|
+
//#region src/composables/useModalDialog.ts
|
|
3
|
+
function o(o, s) {
|
|
4
|
+
let c = i(), l = r(null), u = r(!1), d = e(() => o.value || u.value), f = e(() => s.persistentBackdrop() ? s.persistentEscape() ? "none" : "closerequest" : "any"), p = e(() => ({
|
|
5
|
+
...c,
|
|
6
|
+
closedby: f.value
|
|
7
|
+
}));
|
|
8
|
+
function m() {
|
|
9
|
+
return o.value = !0, t();
|
|
10
|
+
}
|
|
11
|
+
function h() {
|
|
12
|
+
l.value?.close();
|
|
13
|
+
}
|
|
14
|
+
a(o, (e) => {
|
|
15
|
+
e ? l.value && !l.value.open && l.value.showModal() : l.value?.close();
|
|
16
|
+
}), a(l, (e) => e?.showModal(), { flush: "post" });
|
|
17
|
+
let g = 0;
|
|
18
|
+
async function _(e) {
|
|
19
|
+
let t = ++g;
|
|
20
|
+
u.value = !0, await Promise.allSettled(e.getAnimations().map((e) => e.finished)), t === g && !o.value && (u.value = !1);
|
|
21
|
+
}
|
|
22
|
+
function v(e) {
|
|
23
|
+
let t = l.value;
|
|
24
|
+
!t || e.target !== t || (o.value = !1, s.exitTransition && _(t));
|
|
25
|
+
}
|
|
26
|
+
n(() => {
|
|
27
|
+
o.value &&= !1;
|
|
28
|
+
});
|
|
29
|
+
let y = () => !("closedBy" in HTMLDialogElement.prototype);
|
|
30
|
+
function b(e) {
|
|
31
|
+
y() && f.value === "none" && e.preventDefault();
|
|
32
|
+
}
|
|
33
|
+
function x(e) {
|
|
34
|
+
let t = l.value?.getBoundingClientRect();
|
|
35
|
+
return t ? e.clientX < t.left || e.clientX > t.right || e.clientY < t.top || e.clientY > t.bottom : !1;
|
|
36
|
+
}
|
|
37
|
+
let S = !1;
|
|
38
|
+
function C(e) {
|
|
39
|
+
S = y() && e.target === l.value && x(e);
|
|
40
|
+
}
|
|
41
|
+
function w(e) {
|
|
42
|
+
let t = S && e.target === l.value && x(e);
|
|
43
|
+
S = !1, t && y() && f.value === "any" && h();
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
dialogEl: l,
|
|
47
|
+
rendered: d,
|
|
48
|
+
rootAttrs: p,
|
|
49
|
+
show: m,
|
|
50
|
+
close: h,
|
|
51
|
+
onClose: v,
|
|
52
|
+
onCancel: b,
|
|
53
|
+
onPointerdown: C,
|
|
54
|
+
onBackdropClick: w
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { o as useModalDialog };
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=useModalDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useModalDialog.js","names":[],"sources":["../../src/composables/useModalDialog.ts"],"sourcesContent":["import { computed, nextTick, onBeforeUnmount, ref, useAttrs, watch } from 'vue'\nimport type { Ref } from 'vue'\n\n// @core\n/**\n * The bridge between a `v-model:open` and a native modal `<dialog>`, shared by VDialog and\n * VDrawer. Native showModal supplies top-layer placement and modal focus; this bridges the model\n * to the imperative open and close, and provides guarded dismissal where closedBy is absent.\n *\n * The element is rendered only while it is needed. With `exitTransition`, it outlives its\n * closing until the transitions it runs on the way out have finished.\n */\nexport function useModalDialog(\n open: Ref<boolean>,\n options: {\n persistentBackdrop: () => boolean\n persistentEscape: () => boolean\n exitTransition?: boolean\n },\n) {\n const attrs = useAttrs()\n const dialogEl = ref<HTMLDialogElement | null>(null)\n\n /** Whether the `<dialog>` is in the page: while open, and through its exit if it has one. */\n const leaving = ref(false)\n const rendered = computed(() => open.value || leaving.value)\n\n /**\n * Which dismissals the browser itself accepts, declared as an attribute rather than handled in\n * code: everything, Escape alone, or nothing. One combination cannot be expressed that way; a\n * click outside allowed while Escape is not; and it falls back to allowing both.\n */\n const closedby = computed(() =>\n options.persistentBackdrop() ? (options.persistentEscape() ? 'none' : 'closerequest') : 'any',\n )\n\n // @fallback\n // The `closedby` attribute is newer than the type definitions shipped with TypeScript, so\n // writing it directly in the template would be reported as an unknown attribute. Passing it\n // inside a bound object goes through the same path as any forwarded attribute, which is not\n // checked element by element.\n const rootAttrs = computed(() => ({ ...attrs, closedby: closedby.value }))\n\n function show(): Promise<void> {\n open.value = true\n return nextTick()\n }\n\n function close() {\n // Closing the element is enough: the browser then fires its own close event, which puts the\n // model back in step below.\n dialogEl.value?.close()\n }\n\n // Close before v-if removes the element so the browser restores the invoker's focus.\n watch(open, (value) => {\n if (!value) dialogEl.value?.close()\n // Reopened during its exit, the same element is shown again and its transitions reverse.\n else if (dialogEl.value && !dialogEl.value.open) dialogEl.value.showModal()\n })\n\n // @ssr\n // Template refs become available after mounting, including when hydrating an open dialog.\n watch(dialogEl, (dialog) => dialog?.showModal(), { flush: 'post' })\n\n /*\n * Each closing is counted, so that the end of an exit interrupted by a reopening, then\n * followed by a second closing, does not remove the element in the middle of the second exit.\n */\n let closings = 0\n async function leave(dialog: HTMLDialogElement) {\n const closing = ++closings\n leaving.value = true\n // Reading the animations flushes the style change the closing made, so the exit\n // transitions have already started. A reversed or cancelled one rejects: either way it is\n // over.\n await Promise.allSettled(dialog.getAnimations().map((animation) => animation.finished))\n if (closing === closings && !open.value) leaving.value = false\n }\n\n // Ignore close events from replaced elements: the queued event from a quick close-and-reopen\n // must not close the new dialog.\n function onClose(event: Event) {\n const dialog = dialogEl.value\n if (!dialog || event.target !== dialog) return\n open.value = false\n if (options.exitTransition) void leave(dialog)\n }\n\n // @core\n // An open dialog removed with its parent (a `v-if`, a route change) runs no close steps,\n // so no close event would come: the model is handed back closed here, or it stayed `true`\n // and the dialog reopened by itself the next time its parent was shown.\n onBeforeUnmount(() => {\n if (open.value) open.value = false\n })\n\n // @fallback\n /*\n * `closedby` is what applies `persistentBackdrop` and `persistentEscape`, and Safari does not\n * implement it: there Escape always closes and the backdrop never does. The two halves are\n * rebuilt below, and only where the attribute is unknown, so a browser that has it is never\n * second-guessed.\n */\n const closedbyUnsupported = () => !('closedBy' in HTMLDialogElement.prototype)\n\n function onCancel(event: Event) {\n if (closedbyUnsupported() && closedby.value === 'none') event.preventDefault()\n }\n\n /**\n * Whether a point lies outside the dialog's box, which is where the backdrop is: a click on\n * the `::backdrop` is dispatched to the dialog element itself.\n */\n function outsideBox(event: MouseEvent) {\n const box = dialogEl.value?.getBoundingClientRect()\n if (!box) return false\n return (\n event.clientX < box.left ||\n event.clientX > box.right ||\n event.clientY < box.top ||\n event.clientY > box.bottom\n )\n }\n\n // A press that STARTED inside and ended on the backdrop (a text selection dragged past the\n // edge) is not a click on the backdrop, so the press is remembered, not only the release.\n let pressedOnBackdrop = false\n function onPointerdown(event: PointerEvent) {\n pressedOnBackdrop =\n closedbyUnsupported() && event.target === dialogEl.value && outsideBox(event)\n }\n function onBackdropClick(event: MouseEvent) {\n const onBackdrop = pressedOnBackdrop && event.target === dialogEl.value && outsideBox(event)\n pressedOnBackdrop = false\n if (onBackdrop && closedbyUnsupported() && closedby.value === 'any') close()\n }\n\n return {\n dialogEl,\n rendered,\n rootAttrs,\n show,\n close,\n onClose,\n onCancel,\n onPointerdown,\n onBackdropClick,\n }\n}\n"],"mappings":";;AAYA,SAAgB,EACd,GACA,GAKA;CACA,IAAM,IAAQ,EAAS,GACjB,IAAW,EAA8B,IAAI,GAG7C,IAAU,EAAI,EAAK,GACnB,IAAW,QAAe,EAAK,SAAS,EAAQ,KAAK,GAOrD,IAAW,QACf,EAAQ,mBAAmB,IAAK,EAAQ,iBAAiB,IAAI,SAAS,iBAAkB,KAC1F,GAOM,IAAY,SAAgB;EAAE,GAAG;EAAO,UAAU,EAAS;CAAM,EAAE;CAEzE,SAAS,IAAsB;EAE7B,OADA,EAAK,QAAQ,IACN,EAAS;CAClB;CAEA,SAAS,IAAQ;EAGf,EAAS,OAAO,MAAM;CACxB;CAWA,AARA,EAAM,IAAO,MAAU;EACrB,AAAK,IAEI,EAAS,SAAS,CAAC,EAAS,MAAM,QAAM,EAAS,MAAM,UAAU,IAF9D,EAAS,OAAO,MAAM;CAGpC,CAAC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ClassBinding = false | null | undefined | string | Record<string, unknown> | ClassBinding[];
|
|
7
7
|
/**
|
|
8
|
-
* The attribute split of the wrapper-root pattern
|
|
9
|
-
*
|
|
10
|
-
* and the three choice controls, whose root holds the <label> and its hint.
|
|
8
|
+
* The attribute split of the wrapper-root pattern: `class` and `style` stay on a root that is
|
|
9
|
+
* only a container, and every other attribute goes to the functional element.
|
|
11
10
|
*/
|
|
12
11
|
export declare function useRootAttrs(): {
|
|
13
12
|
attrs: Record<string, unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRootAttrs.js","names":[],"sources":["../../src/composables/useRootAttrs.ts"],"sourcesContent":["import { computed, useAttrs, type ComputedRef, type StyleValue } from 'vue'\n\n/**\n * Redeclared locally: `@vue/runtime-dom` exports this as `ClassValue` and the `vue` package\n * does not re-export it. Typed `unknown` instead, a template refuses to bind it.\n */\ntype ClassBinding = false | null | undefined | string | Record<string, unknown> | ClassBinding[]\n\n// @a11y\n/**\n * The attribute split of the wrapper-root pattern
|
|
1
|
+
{"version":3,"file":"useRootAttrs.js","names":[],"sources":["../../src/composables/useRootAttrs.ts"],"sourcesContent":["import { computed, useAttrs, type ComputedRef, type StyleValue } from 'vue'\n\n/**\n * Redeclared locally: `@vue/runtime-dom` exports this as `ClassValue` and the `vue` package\n * does not re-export it. Typed `unknown` instead, a template refuses to bind it.\n */\ntype ClassBinding = false | null | undefined | string | Record<string, unknown> | ClassBinding[]\n\n// @a11y\n/**\n * The attribute split of the wrapper-root pattern: `class` and `style` stay on a root that is\n * only a container, and every other attribute goes to the functional element.\n */\nexport function useRootAttrs(): {\n attrs: Record<string, unknown>\n rootClass: ComputedRef<ClassBinding>\n rootStyle: ComputedRef<StyleValue>\n forwardedAttrs: ComputedRef<Record<string, unknown>>\n} {\n const attrs = useAttrs()\n // Read the styling keys even when absent: enumerating an empty attrs object tracks no reads.\n const split = computed(() => {\n const { class: rootClass, style: rootStyle, ...forwardedAttrs } = attrs\n return { rootClass, rootStyle, forwardedAttrs }\n })\n\n return {\n attrs,\n rootClass: computed(() => split.value.rootClass as ClassBinding),\n rootStyle: computed(() => split.value.rootStyle as StyleValue),\n forwardedAttrs: computed(() => split.value.forwardedAttrs),\n }\n}\n"],"mappings":";;AAaA,SAAgB,IAKd;CACA,IAAM,IAAQ,EAAS,GAEjB,IAAQ,QAAe;EAC3B,IAAM,EAAE,OAAO,GAAW,OAAO,GAAW,GAAG,MAAmB;EAClE,OAAO;GAAE;GAAW;GAAW;EAAe;CAChD,CAAC;CAED,OAAO;EACL;EACA,WAAW,QAAe,EAAM,MAAM,SAAyB;EAC/D,WAAW,QAAe,EAAM,MAAM,SAAuB;EAC7D,gBAAgB,QAAe,EAAM,MAAM,cAAc;CAC3D;AACF"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ComponentPublicInstance, ComputedRef, Ref } from 'vue';
|
|
2
|
+
export interface VirtualListOptions {
|
|
3
|
+
/** The element that scrolls. Null disables the windowing: every row up to `initialCount`. */
|
|
4
|
+
scrollEl: Readonly<Ref<HTMLElement | null>>;
|
|
5
|
+
/** How many rows there are. */
|
|
6
|
+
count: () => number;
|
|
7
|
+
/** A stable identity for a row, under which its measured size is remembered. */
|
|
8
|
+
key: (index: number) => unknown;
|
|
9
|
+
/** The height assumed for a row not measured yet, in pixels. */
|
|
10
|
+
itemSize: () => number;
|
|
11
|
+
/** How many rows to render beyond each edge of the viewport. */
|
|
12
|
+
overscan: () => number;
|
|
13
|
+
/** How many rows to render before the container is measured: on the server and at hydration. */
|
|
14
|
+
initialCount: () => number;
|
|
15
|
+
/** Rows kept rendered wherever the scroll is: the active option, the row holding the focus. */
|
|
16
|
+
pinned?: () => readonly number[];
|
|
17
|
+
/**
|
|
18
|
+
* The element the rows sit in, when content comes before it inside the scroll container: a
|
|
19
|
+
* table's caption and heading. Its distance from the top of the scrolled content replaces the
|
|
20
|
+
* container's top padding.
|
|
21
|
+
*/
|
|
22
|
+
listEl?: Readonly<Ref<HTMLElement | null>>;
|
|
23
|
+
/**
|
|
24
|
+
* The height a sticky element covers at the top of the viewport, a table's frozen heading:
|
|
25
|
+
* an alignment keeps rows out from under it. The container's top padding otherwise.
|
|
26
|
+
*/
|
|
27
|
+
insetStart?: () => number;
|
|
28
|
+
}
|
|
29
|
+
/** A row to render, or a block of empty space standing for the rows left out. */
|
|
30
|
+
export type VirtualSegment = {
|
|
31
|
+
type: 'row';
|
|
32
|
+
index: number;
|
|
33
|
+
} | {
|
|
34
|
+
type: 'spacer';
|
|
35
|
+
key: string;
|
|
36
|
+
size: number;
|
|
37
|
+
};
|
|
38
|
+
export interface VirtualList {
|
|
39
|
+
/** What to render, in order. */
|
|
40
|
+
segments: ComputedRef<VirtualSegment[]>;
|
|
41
|
+
/** The template ref of a rendered row: `:ref="(el) => measure(el, index)"`. */
|
|
42
|
+
measure: (target: Element | ComponentPublicInstance | null, index: number) => void;
|
|
43
|
+
/** Scrolls the container until the row is in view, rendering it first if it is not. */
|
|
44
|
+
scrollToIndex: (index: number, align?: ScrollLogicalPosition) => Promise<void>;
|
|
45
|
+
}
|
|
46
|
+
export declare function useVirtualList(options: VirtualListOptions): VirtualList;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { computed as e, nextTick as t, onBeforeUnmount as n, ref as r, watch as i } from "vue";
|
|
2
|
+
//#region src/composables/useVirtualList.ts
|
|
3
|
+
function a(a) {
|
|
4
|
+
let o = /* @__PURE__ */ new Map(), s = r(0), c = r(0), l = r(0), u = r(0), d = r(0), f = r(!1), p = e(() => {
|
|
5
|
+
s.value;
|
|
6
|
+
let e = a.count(), t = a.itemSize() + d.value, n = new Float64Array(e + 1);
|
|
7
|
+
for (let r = 0; r < e; r++) {
|
|
8
|
+
let e = o.size > 0 ? o.get(a.key(r)) : void 0;
|
|
9
|
+
n[r + 1] = n[r] + (e ?? t);
|
|
10
|
+
}
|
|
11
|
+
return n;
|
|
12
|
+
});
|
|
13
|
+
function m(e) {
|
|
14
|
+
let t = p.value, n = 0, r = t.length - 2;
|
|
15
|
+
for (; n < r;) {
|
|
16
|
+
let i = n + r + 1 >> 1;
|
|
17
|
+
t[i] <= e ? n = i : r = i - 1;
|
|
18
|
+
}
|
|
19
|
+
return Math.max(0, n);
|
|
20
|
+
}
|
|
21
|
+
let h = e(() => f.value ? Math.max(0, m(c.value - u.value) - a.overscan()) : 0), g = e(() => {
|
|
22
|
+
let e = a.count();
|
|
23
|
+
if (!f.value) return Math.min(e, a.initialCount());
|
|
24
|
+
let t = m(c.value - u.value + l.value);
|
|
25
|
+
return Math.min(e, t + 1 + a.overscan());
|
|
26
|
+
}), _ = e(() => {
|
|
27
|
+
let e = a.count(), t = p.value, n = h.value, r = g.value, i = [...new Set(a.pinned?.() ?? [])].filter((t) => t >= 0 && t < e && (t < n || t >= r)).sort((e, t) => e - t), o = i.filter((e) => e < n);
|
|
28
|
+
for (let e = n; e < r; e++) o.push(e);
|
|
29
|
+
o.push(...i.filter((e) => e >= r));
|
|
30
|
+
let s = [], c = 0;
|
|
31
|
+
for (let e of o) e > c && s.push(v(c, t[e] - t[c])), s.push({
|
|
32
|
+
type: "row",
|
|
33
|
+
index: e
|
|
34
|
+
}), c = e + 1;
|
|
35
|
+
return c < e && s.push(v(c, t[e] - t[c])), s;
|
|
36
|
+
});
|
|
37
|
+
function v(e, t) {
|
|
38
|
+
return {
|
|
39
|
+
type: "spacer",
|
|
40
|
+
key: `spacer:${e}`,
|
|
41
|
+
size: Math.max(0, t - d.value)
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
let y = /* @__PURE__ */ new Set(), b = /* @__PURE__ */ new WeakMap(), x;
|
|
45
|
+
function S(e, t) {
|
|
46
|
+
let n = e && "$el" in e ? e.$el : e;
|
|
47
|
+
n instanceof HTMLElement && (b.set(n, t), !y.has(n) && (y.add(n), x?.observe(n)));
|
|
48
|
+
}
|
|
49
|
+
function C(e, t) {
|
|
50
|
+
let n = b.get(e);
|
|
51
|
+
if (n === void 0 || n >= a.count()) return 0;
|
|
52
|
+
let r = a.key(n), i = t + d.value, s = o.get(r) ?? a.itemSize() + d.value;
|
|
53
|
+
return Math.abs(i - s) < .5 ? 0 : (o.set(r, i), i - s);
|
|
54
|
+
}
|
|
55
|
+
function w(e) {
|
|
56
|
+
let t = getComputedStyle(e), n = a.listEl?.value;
|
|
57
|
+
l.value = e.clientHeight, u.value = n ? T(e, n) : parseFloat(t.paddingTop) || 0, d.value = parseFloat(t.rowGap) || 0;
|
|
58
|
+
}
|
|
59
|
+
function T(e, t) {
|
|
60
|
+
return (t.getBoundingClientRect().top - e.getBoundingClientRect().top) / P(e) - e.clientTop + e.scrollTop;
|
|
61
|
+
}
|
|
62
|
+
let E = 0, D = !1, O = !1;
|
|
63
|
+
function k() {
|
|
64
|
+
E ||= requestAnimationFrame(j);
|
|
65
|
+
}
|
|
66
|
+
function A() {
|
|
67
|
+
E && cancelAnimationFrame(E), E = 0, D = O = !1;
|
|
68
|
+
}
|
|
69
|
+
function j() {
|
|
70
|
+
E = 0;
|
|
71
|
+
let e = a.scrollEl.value;
|
|
72
|
+
e && (D && w(e), c.value = e.scrollTop), O && s.value++, D = O = !1;
|
|
73
|
+
}
|
|
74
|
+
function M(e) {
|
|
75
|
+
let t = a.scrollEl.value;
|
|
76
|
+
if (!t || t.getClientRects().length === 0) return;
|
|
77
|
+
let n = p.value, r = t.scrollTop - u.value, i = 0;
|
|
78
|
+
for (let o of e) {
|
|
79
|
+
if (o.target === t || o.target === a.listEl?.value) {
|
|
80
|
+
D = !0;
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (!o.target.isConnected) continue;
|
|
84
|
+
let e = b.get(o.target), s = C(o.target, o.borderBoxSize[0]?.blockSize ?? 0);
|
|
85
|
+
s !== 0 && (O = !0, e !== void 0 && n[e] < r && (i += s));
|
|
86
|
+
}
|
|
87
|
+
i !== 0 && (t.scrollTop += i), (D || O || i !== 0) && k();
|
|
88
|
+
}
|
|
89
|
+
function N(e) {
|
|
90
|
+
let t = P(e), n = !1;
|
|
91
|
+
for (let e of y) e.isConnected && C(e, e.getBoundingClientRect().height / t) !== 0 && (n = !0);
|
|
92
|
+
n && s.value++;
|
|
93
|
+
}
|
|
94
|
+
function P(e) {
|
|
95
|
+
let t = e.offsetHeight;
|
|
96
|
+
return t > 0 && e.getBoundingClientRect().height / t || 1;
|
|
97
|
+
}
|
|
98
|
+
function F(e) {
|
|
99
|
+
for (let t of y) if (t.isConnected && b.get(t) === e) return t;
|
|
100
|
+
}
|
|
101
|
+
let I = (e) => {
|
|
102
|
+
c.value = e.currentTarget.scrollTop;
|
|
103
|
+
};
|
|
104
|
+
i(a.scrollEl, (e, t, n) => {
|
|
105
|
+
if (f.value = !!e, e) {
|
|
106
|
+
if (w(e), c.value = e.scrollTop, e.addEventListener("scroll", I, { passive: !0 }), typeof ResizeObserver < "u") {
|
|
107
|
+
x = new ResizeObserver(M), x.observe(e), a.listEl?.value && x.observe(a.listEl.value);
|
|
108
|
+
for (let e of y) x.observe(e);
|
|
109
|
+
}
|
|
110
|
+
n(() => {
|
|
111
|
+
e.removeEventListener("scroll", I), x?.disconnect(), x = void 0, A();
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}, {
|
|
115
|
+
flush: "post",
|
|
116
|
+
immediate: !0
|
|
117
|
+
}), i(_, () => {
|
|
118
|
+
for (let e of y) e.isConnected || (x?.unobserve(e), y.delete(e));
|
|
119
|
+
}, { flush: "post" }), n(() => {
|
|
120
|
+
y.clear(), A();
|
|
121
|
+
});
|
|
122
|
+
async function L(e, n = "nearest") {
|
|
123
|
+
let r = a.scrollEl.value;
|
|
124
|
+
if (!r || e < 0 || e >= a.count()) return;
|
|
125
|
+
if (!F(e)) {
|
|
126
|
+
let i = p.value[e], a = p.value[e + 1] - r.clientHeight, o = i;
|
|
127
|
+
n === "end" ? o = a : n === "center" ? o = (i + a) / 2 : n === "nearest" && i >= r.scrollTop - u.value && (o = a), r.scrollTop = u.value + o, c.value = r.scrollTop, await t();
|
|
128
|
+
}
|
|
129
|
+
let i = F(e);
|
|
130
|
+
i && (N(r), R(r, i, n));
|
|
131
|
+
}
|
|
132
|
+
function R(e, t, n) {
|
|
133
|
+
let r = getComputedStyle(e), i = a.insetStart?.() ?? (parseFloat(r.paddingTop) || 0), o = parseFloat(r.paddingBottom) || 0, s = T(e, t), l = t.getBoundingClientRect().height / P(e), u = s + l, d = e.clientHeight, f = e.scrollTop;
|
|
134
|
+
n === "start" ? f = s - i : n === "end" ? f = u - d + o : n === "center" ? f = s + l / 2 - d / 2 : s - i < e.scrollTop ? f = s - i : u + o > e.scrollTop + d && (f = u - d + o), e.scrollTop = f, c.value = e.scrollTop;
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
segments: _,
|
|
138
|
+
measure: S,
|
|
139
|
+
scrollToIndex: L
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
//#endregion
|
|
143
|
+
export { a as useVirtualList };
|
|
144
|
+
|
|
145
|
+
//# sourceMappingURL=useVirtualList.js.map
|