vectis-ui 0.1.0 → 0.8.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/README.md +40 -6
- package/dist/components/VAccordion/VAccordion.css +1 -1
- package/dist/components/VAccordion/VAccordion.d.ts +9 -16
- package/dist/components/VAccordion/VAccordion.js.map +1 -1
- package/dist/components/VAccordion/VAccordion.vue_vue_type_script_setup_true_lang.js +3 -3
- 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 +33 -19
- package/dist/components/VAccordion/VAccordionItem.js.map +1 -1
- package/dist/components/VAccordion/VAccordionItem.vue_vue_type_script_setup_true_lang.js +50 -38
- package/dist/components/VAccordion/VAccordionItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VAccordion/context.d.ts +1 -8
- package/dist/components/VAccordion/context.js.map +1 -1
- package/dist/components/VAvatar/VAvatar.css +1 -1
- package/dist/components/VAvatar/VAvatar.d.ts +44 -29
- package/dist/components/VAvatar/VAvatar.js.map +1 -1
- package/dist/components/VAvatar/VAvatar.vue_vue_type_script_setup_true_lang.js +38 -35
- package/dist/components/VAvatar/VAvatar.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VAvatar/VAvatarGroup.d.ts +5 -16
- package/dist/components/VAvatar/VAvatarGroup.js.map +1 -1
- package/dist/components/VAvatar/VAvatarGroup.vue_vue_type_script_setup_true_lang.js +7 -7
- package/dist/components/VAvatar/VAvatarGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VAvatar/context.d.ts +6 -10
- package/dist/components/VAvatar/context.js.map +1 -1
- package/dist/components/VBadge/VBadge.css +1 -1
- package/dist/components/VBadge/VBadge.d.ts +31 -10
- package/dist/components/VBadge/VBadge.js.map +1 -1
- package/dist/components/VBadge/VBadge.vue_vue_type_script_setup_true_lang.js +39 -24
- package/dist/components/VBadge/VBadge.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VBreadcrumb/VBreadcrumb.css +1 -1
- package/dist/components/VBreadcrumb/VBreadcrumb.d.ts +4 -17
- package/dist/components/VBreadcrumb/VBreadcrumb.js.map +1 -1
- package/dist/components/VBreadcrumb/VBreadcrumb.vue_vue_type_script_setup_true_lang.js +23 -25
- package/dist/components/VBreadcrumb/VBreadcrumb.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VButton/VButton.css +1 -1
- package/dist/components/VButton/VButton.d.ts +30 -10
- package/dist/components/VButton/VButton.js.map +1 -1
- package/dist/components/VButton/VButton.vue_vue_type_script_setup_true_lang.js +39 -30
- package/dist/components/VButton/VButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VButton/VButtonGroup.css +1 -1
- package/dist/components/VButton/VButtonGroup.d.ts +76 -13
- package/dist/components/VButton/VButtonGroup.js.map +1 -1
- package/dist/components/VButton/VButtonGroup.vue_vue_type_script_setup_true_lang.js +74 -8
- package/dist/components/VButton/VButtonGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VButton/context.d.ts +30 -0
- package/dist/components/VButton/context.js +6 -0
- package/dist/components/VButton/context.js.map +1 -0
- package/dist/components/VCalendar/VCalendar.css +1 -1
- package/dist/components/VCalendar/VCalendar.d.ts +50 -36
- package/dist/components/VCalendar/VCalendar.js.map +1 -1
- package/dist/components/VCalendar/VCalendar.vue_vue_type_script_setup_true_lang.js +99 -85
- package/dist/components/VCalendar/VCalendar.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCalendar/VCalendarEvent.css +1 -1
- package/dist/components/VCalendar/VCalendarEvent.d.ts +5 -11
- package/dist/components/VCalendar/VCalendarEvent.js.map +1 -1
- package/dist/components/VCalendar/VCalendarEvent.vue_vue_type_script_setup_true_lang.js +7 -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 +10 -13
- package/dist/components/VCalendar/VCalendarMonth.js.map +1 -1
- package/dist/components/VCalendar/VCalendarMonth.vue_vue_type_script_setup_true_lang.js +183 -244
- 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 +15 -20
- package/dist/components/VCalendar/VCalendarTimeGrid.js.map +1 -1
- package/dist/components/VCalendar/VCalendarTimeGrid.vue_vue_type_script_setup_true_lang.js +385 -448
- 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 +53 -49
- package/dist/components/VCalendar/VCalendarYear.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCalendar/gesture.d.ts +158 -0
- package/dist/components/VCalendar/gesture.js +170 -0
- package/dist/components/VCalendar/gesture.js.map +1 -0
- package/dist/components/VCalendar/keyboard.d.ts +9 -3
- package/dist/components/VCalendar/keyboard.js +2 -6
- package/dist/components/VCalendar/keyboard.js.map +1 -1
- package/dist/components/VCalendar/layout.d.ts +67 -54
- package/dist/components/VCalendar/layout.js +77 -69
- package/dist/components/VCalendar/layout.js.map +1 -1
- package/dist/components/VCalendar/timeGrid.d.ts +55 -0
- package/dist/components/VCalendar/timeGrid.js +71 -0
- package/dist/components/VCalendar/timeGrid.js.map +1 -0
- package/dist/components/VCalendar/types.d.ts +41 -16
- package/dist/components/VCarousel/VCarousel.css +1 -1
- package/dist/components/VCarousel/VCarousel.d.ts +21 -41
- package/dist/components/VCarousel/VCarousel.js.map +1 -1
- package/dist/components/VCarousel/VCarousel.vue_vue_type_script_setup_true_lang.js +157 -129
- package/dist/components/VCarousel/VCarousel.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCarousel/VCarouselItem.d.ts +0 -17
- package/dist/components/VCarousel/VCarouselItem.js.map +1 -1
- package/dist/components/VCarousel/VCarouselItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCarousel/context.d.ts +0 -12
- package/dist/components/VCarousel/context.js.map +1 -1
- package/dist/components/VCheckbox/VCheckbox.css +1 -1
- package/dist/components/VCheckbox/VCheckbox.d.ts +31 -16
- package/dist/components/VCheckbox/VCheckbox.js.map +1 -1
- package/dist/components/VCheckbox/VCheckbox.vue_vue_type_script_setup_true_lang.js +62 -29
- package/dist/components/VCheckbox/VCheckbox.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VChip/VChip.css +1 -1
- package/dist/components/VChip/VChip.d.ts +36 -26
- package/dist/components/VChip/VChip.js.map +1 -1
- package/dist/components/VChip/VChip.vue_vue_type_script_setup_true_lang.js +57 -48
- package/dist/components/VChip/VChip.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCombobox/VCombobox.css +1 -1
- package/dist/components/VCombobox/VCombobox.d.ts +127 -31
- package/dist/components/VCombobox/VCombobox.js.map +1 -1
- package/dist/components/VCombobox/VCombobox.vue_vue_type_script_setup_true_lang.js +336 -247
- package/dist/components/VCombobox/VCombobox.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCombobox/VComboboxGroup.css +1 -1
- package/dist/components/VCombobox/VComboboxGroup.d.ts +0 -9
- package/dist/components/VCombobox/VComboboxGroup.js.map +1 -1
- package/dist/components/VCombobox/VComboboxGroup.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/VCombobox/VComboboxGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCombobox/VComboboxOption.css +1 -1
- package/dist/components/VCombobox/VComboboxOption.d.ts +0 -15
- package/dist/components/VCombobox/VComboboxOption.js.map +1 -1
- package/dist/components/VCombobox/VComboboxOption.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/components/VCombobox/VComboboxOption.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCombobox/VComboboxSeparator.js.map +1 -1
- package/dist/components/VCombobox/VComboboxSeparator.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VCombobox/infiniteScroll.js.map +1 -1
- package/dist/components/VDataTable/VDataTable.css +1 -1
- package/dist/components/VDataTable/VDataTable.d.ts +50 -28
- package/dist/components/VDataTable/VDataTable.js.map +1 -1
- package/dist/components/VDataTable/VDataTable.vue_vue_type_script_setup_true_lang.js +183 -194
- package/dist/components/VDataTable/VDataTable.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VDateInput/VDateInput.css +1 -1
- package/dist/components/VDateInput/VDateInput.d.ts +90 -42
- package/dist/components/VDateInput/VDateInput.js.map +1 -1
- package/dist/components/VDateInput/VDateInput.vue_vue_type_script_setup_true_lang.js +159 -191
- package/dist/components/VDateInput/VDateInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VDatePicker/VDatePicker.css +1 -1
- package/dist/components/VDatePicker/VDatePicker.d.ts +61 -30
- package/dist/components/VDatePicker/VDatePicker.js.map +1 -1
- package/dist/components/VDatePicker/VDatePicker.vue_vue_type_script_setup_true_lang.js +243 -221
- package/dist/components/VDatePicker/VDatePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VDialog/VDialog.css +1 -1
- package/dist/components/VDialog/VDialog.d.ts +45 -33
- package/dist/components/VDialog/VDialog.js.map +1 -1
- package/dist/components/VDialog/VDialog.vue_vue_type_script_setup_true_lang.js +65 -64
- package/dist/components/VDialog/VDialog.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VDialog/VDialogAlert.d.ts +24 -20
- package/dist/components/VDialog/VDialogAlert.js.map +1 -1
- package/dist/components/VDialog/VDialogAlert.vue_vue_type_script_setup_true_lang.js +36 -25
- package/dist/components/VDialog/VDialogAlert.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VFileInput/VFileInput.css +1 -1
- package/dist/components/VFileInput/VFileInput.d.ts +78 -26
- package/dist/components/VFileInput/VFileInput.js.map +1 -1
- package/dist/components/VFileInput/VFileInput.vue_vue_type_script_setup_true_lang.js +144 -132
- package/dist/components/VFileInput/VFileInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VFilePicker/VFilePicker.css +1 -1
- package/dist/components/VFilePicker/VFilePicker.d.ts +47 -30
- package/dist/components/VFilePicker/VFilePicker.js.map +1 -1
- package/dist/components/VFilePicker/VFilePicker.vue_vue_type_script_setup_true_lang.js +166 -163
- package/dist/components/VFilePicker/VFilePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VFilePicker/fileKind.d.ts +2 -27
- package/dist/components/VFilePicker/fileKind.js +9 -8
- package/dist/components/VFilePicker/fileKind.js.map +1 -1
- package/dist/components/VHotkeys/VHotkeys.css +1 -1
- package/dist/components/VHotkeys/VHotkeys.d.ts +8 -30
- package/dist/components/VHotkeys/VHotkeys.js.map +1 -1
- package/dist/components/VHotkeys/VHotkeys.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/components/VHotkeys/VHotkeys.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VHotkeys/platform.js.map +1 -1
- package/dist/components/VIcon/VIcon.css +1 -1
- package/dist/components/VIcon/VIcon.d.ts +15 -6
- package/dist/components/VIcon/VIcon.js.map +1 -1
- package/dist/components/VIcon/VIcon.vue_vue_type_script_setup_true_lang.js +45 -37
- package/dist/components/VIcon/VIcon.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VIcon/iconProps.js.map +1 -1
- package/dist/components/VIcon/icons/index.d.ts +1 -1
- package/dist/components/VIcon/icons/index.js.map +1 -1
- package/dist/components/VIcon/icons/names.d.ts +1 -1
- package/dist/components/VIcon/icons/names.js.map +1 -1
- package/dist/components/VIcon/resolver.d.ts +3 -3
- package/dist/components/VIcon/resolver.js.map +1 -1
- package/dist/components/VIcon/types.d.ts +12 -12
- package/dist/components/VIconButton/VIconButton.css +1 -1
- package/dist/components/VIconButton/VIconButton.d.ts +28 -11
- package/dist/components/VIconButton/VIconButton.js.map +1 -1
- package/dist/components/VIconButton/VIconButton.vue_vue_type_script_setup_true_lang.js +26 -20
- package/dist/components/VIconButton/VIconButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VInput/VInput.css +1 -1
- package/dist/components/VInput/VInput.d.ts +26 -7
- package/dist/components/VInput/VInput.js.map +1 -1
- package/dist/components/VInput/VInput.vue_vue_type_script_setup_true_lang.js +86 -75
- package/dist/components/VInput/VInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VInput/VInputGroup.css +2 -0
- package/dist/components/VInput/VInputGroup.d.ts +47 -0
- package/dist/components/VInput/VInputGroup.js +9 -0
- package/dist/components/VInput/VInputGroup.js.map +1 -0
- package/dist/components/VInput/VInputGroup.vue_vue_type_script_setup_true_lang.js +80 -0
- package/dist/components/VInput/VInputGroup.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/VInput/context.d.ts +11 -0
- package/dist/components/VInput/context.js +6 -0
- package/dist/components/VInput/context.js.map +1 -0
- package/dist/components/VInputOTP/VInputOTP.css +1 -1
- package/dist/components/VInputOTP/VInputOTP.d.ts +37 -22
- package/dist/components/VInputOTP/VInputOTP.js.map +1 -1
- package/dist/components/VInputOTP/VInputOTP.vue_vue_type_script_setup_true_lang.js +98 -61
- package/dist/components/VInputOTP/VInputOTP.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VMenu/VMenu.d.ts +23 -30
- package/dist/components/VMenu/VMenu.js.map +1 -1
- package/dist/components/VMenu/VMenu.vue_vue_type_script_setup_true_lang.js +31 -27
- package/dist/components/VMenu/VMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VMenu/VMenuGroup.css +1 -1
- package/dist/components/VMenu/VMenuGroup.d.ts +12 -8
- package/dist/components/VMenu/VMenuGroup.js.map +1 -1
- package/dist/components/VMenu/VMenuGroup.vue_vue_type_script_setup_true_lang.js +11 -11
- package/dist/components/VMenu/VMenuGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VMenu/VMenuItem.css +1 -1
- package/dist/components/VMenu/VMenuItem.d.ts +11 -19
- package/dist/components/VMenu/VMenuItem.js.map +1 -1
- package/dist/components/VMenu/VMenuItem.vue_vue_type_script_setup_true_lang.js +65 -57
- package/dist/components/VMenu/VMenuItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VMenu/VMenuPanel.d.ts +14 -30
- package/dist/components/VMenu/VMenuPanel.js.map +1 -1
- package/dist/components/VMenu/VMenuPanel.vue_vue_type_script_setup_true_lang.js +43 -44
- package/dist/components/VMenu/VMenuPanel.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VMenu/context.d.ts +2 -6
- package/dist/components/VMenu/context.js.map +1 -1
- package/dist/components/VPagination/VPagination.css +1 -1
- package/dist/components/VPagination/VPagination.d.ts +60 -22
- package/dist/components/VPagination/VPagination.js.map +1 -1
- package/dist/components/VPagination/VPagination.vue_vue_type_script_setup_true_lang.js +113 -161
- package/dist/components/VPagination/VPagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VPopover/VPopover.css +1 -1
- package/dist/components/VPopover/VPopover.d.ts +26 -7
- package/dist/components/VPopover/VPopover.js.map +1 -1
- package/dist/components/VPopover/VPopover.vue_vue_type_script_setup_true_lang.js +43 -37
- package/dist/components/VPopover/VPopover.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VProgressCircular/VProgressCircular.css +1 -1
- package/dist/components/VProgressCircular/VProgressCircular.d.ts +15 -4
- package/dist/components/VProgressCircular/VProgressCircular.js.map +1 -1
- package/dist/components/VProgressCircular/VProgressCircular.vue_vue_type_script_setup_true_lang.js +32 -30
- package/dist/components/VProgressCircular/VProgressCircular.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VProgressLinear/VProgressLinear.css +1 -1
- package/dist/components/VProgressLinear/VProgressLinear.d.ts +23 -8
- package/dist/components/VProgressLinear/VProgressLinear.js.map +1 -1
- package/dist/components/VProgressLinear/VProgressLinear.vue_vue_type_script_setup_true_lang.js +34 -32
- package/dist/components/VProgressLinear/VProgressLinear.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VRadio/VRadio.css +1 -1
- package/dist/components/VRadio/VRadio.d.ts +36 -18
- package/dist/components/VRadio/VRadio.js.map +1 -1
- package/dist/components/VRadio/VRadio.vue_vue_type_script_setup_true_lang.js +55 -26
- package/dist/components/VRadio/VRadio.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VSeparator/VSeparator.d.ts +4 -2
- 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.css +1 -1
- package/dist/components/VSideNavigation/VSideNavigation.d.ts +5 -19
- package/dist/components/VSideNavigation/VSideNavigation.js.map +1 -1
- package/dist/components/VSideNavigation/VSideNavigation.vue_vue_type_script_setup_true_lang.js +5 -5
- package/dist/components/VSideNavigation/VSideNavigation.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VSideNavigation/VSideNavigationGroup.css +1 -1
- package/dist/components/VSideNavigation/VSideNavigationGroup.d.ts +9 -17
- package/dist/components/VSideNavigation/VSideNavigationGroup.js.map +1 -1
- package/dist/components/VSideNavigation/VSideNavigationGroup.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/VSideNavigation/VSideNavigationGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VSideNavigation/VSideNavigationItem.css +1 -1
- package/dist/components/VSideNavigation/VSideNavigationItem.d.ts +22 -30
- package/dist/components/VSideNavigation/VSideNavigationItem.js.map +1 -1
- package/dist/components/VSideNavigation/VSideNavigationItem.vue_vue_type_script_setup_true_lang.js +77 -87
- package/dist/components/VSideNavigation/VSideNavigationItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VSideNavigation/context.d.ts +0 -14
- package/dist/components/VSideNavigation/context.js.map +1 -1
- package/dist/components/VSkeletonLoader/VSkeletonLoader.css +1 -1
- package/dist/components/VSkeletonLoader/VSkeletonLoader.d.ts +9 -9
- package/dist/components/VSkeletonLoader/VSkeletonLoader.js.map +1 -1
- package/dist/components/VSkeletonLoader/VSkeletonLoader.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VSlider/VSlider.css +1 -1
- package/dist/components/VSlider/VSlider.d.ts +52 -27
- package/dist/components/VSlider/VSlider.js.map +1 -1
- package/dist/components/VSlider/VSlider.vue_vue_type_script_setup_true_lang.js +202 -118
- package/dist/components/VSlider/VSlider.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VSnackbar/VSnackbar.css +1 -1
- package/dist/components/VSnackbar/VSnackbar.d.ts +0 -23
- package/dist/components/VSnackbar/VSnackbar.js.map +1 -1
- package/dist/components/VSnackbar/VSnackbar.vue_vue_type_script_setup_true_lang.js +38 -38
- package/dist/components/VSnackbar/VSnackbar.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VSnackbar/state.d.ts +0 -27
- package/dist/components/VSnackbar/state.js.map +1 -1
- package/dist/components/VSpinner/VSpinner.css +1 -1
- package/dist/components/VSpinner/VSpinner.d.ts +6 -6
- package/dist/components/VSpinner/VSpinner.js.map +1 -1
- package/dist/components/VSpinner/VSpinner.vue_vue_type_script_setup_true_lang.js +10 -9
- package/dist/components/VSpinner/VSpinner.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VSwitch/VSwitch.css +1 -1
- package/dist/components/VSwitch/VSwitch.d.ts +35 -13
- package/dist/components/VSwitch/VSwitch.js.map +1 -1
- package/dist/components/VSwitch/VSwitch.vue_vue_type_script_setup_true_lang.js +62 -21
- 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 +12 -12
- package/dist/components/VTabs/VTab.js.map +1 -1
- package/dist/components/VTabs/VTab.vue_vue_type_script_setup_true_lang.js +36 -24
- package/dist/components/VTabs/VTab.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VTabs/VTabPanel.d.ts +2 -10
- package/dist/components/VTabs/VTabPanel.js.map +1 -1
- package/dist/components/VTabs/VTabPanel.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/components/VTabs/VTabPanel.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 +27 -18
- package/dist/components/VTabs/VTabs.js.map +1 -1
- package/dist/components/VTabs/VTabs.vue_vue_type_script_setup_true_lang.js +92 -81
- package/dist/components/VTabs/VTabs.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VTabs/context.d.ts +9 -19
- package/dist/components/VTabs/context.js +1 -1
- package/dist/components/VTabs/context.js.map +1 -1
- package/dist/components/VTextarea/VTextarea.css +1 -1
- package/dist/components/VTextarea/VTextarea.d.ts +34 -6
- package/dist/components/VTextarea/VTextarea.js.map +1 -1
- package/dist/components/VTextarea/VTextarea.vue_vue_type_script_setup_true_lang.js +91 -74
- package/dist/components/VTextarea/VTextarea.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VTimeInput/VTimeInput.css +1 -1
- package/dist/components/VTimeInput/VTimeInput.d.ts +123 -33
- package/dist/components/VTimeInput/VTimeInput.js.map +1 -1
- package/dist/components/VTimeInput/VTimeInput.vue_vue_type_script_setup_true_lang.js +294 -291
- package/dist/components/VTimeInput/VTimeInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VTimeInput/search.d.ts +24 -0
- package/dist/components/VTimeInput/search.js +22 -0
- package/dist/components/VTimeInput/search.js.map +1 -0
- package/dist/components/VTimePicker/VTimePicker.css +1 -1
- package/dist/components/VTimePicker/VTimePicker.d.ts +51 -30
- package/dist/components/VTimePicker/VTimePicker.js.map +1 -1
- package/dist/components/VTimePicker/VTimePicker.vue_vue_type_script_setup_true_lang.js +216 -151
- package/dist/components/VTimePicker/VTimePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VTimePicker/limits.d.ts +88 -0
- package/dist/components/VTimePicker/limits.js +70 -0
- package/dist/components/VTimePicker/limits.js.map +1 -0
- package/dist/components/VToast/VToast.css +1 -1
- package/dist/components/VToast/VToast.d.ts +0 -10
- package/dist/components/VToast/VToast.js.map +1 -1
- package/dist/components/VToast/VToast.vue_vue_type_script_setup_true_lang.js +10 -10
- package/dist/components/VToast/VToast.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VToast/VToaster.css +1 -1
- package/dist/components/VToast/VToaster.d.ts +0 -17
- package/dist/components/VToast/VToaster.js.map +1 -1
- package/dist/components/VToast/VToaster.vue_vue_type_script_setup_true_lang.js +29 -28
- package/dist/components/VToast/VToaster.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VToast/state.d.ts +10 -19
- package/dist/components/VToast/state.js +1 -1
- package/dist/components/VToast/state.js.map +1 -1
- package/dist/components/VToggle/VToggle.css +1 -1
- package/dist/components/VToggle/VToggle.d.ts +56 -11
- package/dist/components/VToggle/VToggle.js.map +1 -1
- package/dist/components/VToggle/VToggle.vue_vue_type_script_setup_true_lang.js +80 -46
- package/dist/components/VToggle/VToggle.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VToggle/VToggleItem.d.ts +16 -2
- package/dist/components/VToggle/VToggleItem.js +0 -2
- package/dist/components/VToggle/VToggleItem.js.map +1 -1
- package/dist/components/VToggle/VToggleItem.vue_vue_type_script_setup_true_lang.js +23 -15
- package/dist/components/VToggle/VToggleItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VToggle/context.d.ts +4 -24
- package/dist/components/VToggle/context.js.map +1 -1
- package/dist/components/VTooltip/VTooltip.css +1 -1
- package/dist/components/VTooltip/VTooltip.d.ts +9 -33
- package/dist/components/VTooltip/VTooltip.js.map +1 -1
- package/dist/components/VTooltip/VTooltip.vue_vue_type_script_setup_true_lang.js +28 -24
- package/dist/components/VTooltip/VTooltip.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/VTypography/VTypography.js.map +1 -1
- package/dist/components/VTypography/VTypography.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/composables/useAriaLabel.d.ts +0 -17
- package/dist/composables/useAriaLabel.js.map +1 -1
- package/dist/composables/useClearable.d.ts +42 -0
- package/dist/composables/useClearable.js +19 -0
- package/dist/composables/useClearable.js.map +1 -0
- package/dist/composables/useControlShape.d.ts +22 -0
- package/dist/composables/useControlShape.js +13 -0
- package/dist/composables/useControlShape.js.map +1 -0
- package/dist/composables/useDetailsOpen.d.ts +22 -0
- package/dist/composables/useDetailsOpen.js +21 -0
- package/dist/composables/useDetailsOpen.js.map +1 -0
- package/dist/composables/useFieldIds.d.ts +0 -15
- package/dist/composables/useFieldIds.js +8 -7
- package/dist/composables/useFieldIds.js.map +1 -1
- package/dist/composables/useFieldPanel.d.ts +21 -18
- package/dist/composables/useFieldPanel.js +43 -23
- package/dist/composables/useFieldPanel.js.map +1 -1
- package/dist/composables/useFileDrop.d.ts +0 -22
- package/dist/composables/useFileDrop.js.map +1 -1
- package/dist/composables/useFileField.d.ts +45 -17
- package/dist/composables/useFileField.js +40 -20
- package/dist/composables/useFileField.js.map +1 -1
- package/dist/composables/useFocusoutDismiss.d.ts +0 -15
- package/dist/composables/useFocusoutDismiss.js.map +1 -1
- package/dist/composables/useIconClickHandlers.d.ts +29 -14
- package/dist/composables/useIconClickHandlers.js +15 -5
- package/dist/composables/useIconClickHandlers.js.map +1 -1
- package/dist/composables/useInertLink.d.ts +20 -0
- package/dist/composables/useInertLink.js +23 -0
- package/dist/composables/useInertLink.js.map +1 -0
- package/dist/composables/useMaskedField.d.ts +33 -10
- package/dist/composables/useMaskedField.js +45 -1
- package/dist/composables/useMaskedField.js.map +1 -1
- package/dist/composables/usePopover.d.ts +15 -1
- package/dist/composables/usePopover.js +23 -8
- package/dist/composables/usePopover.js.map +1 -1
- package/dist/composables/useProgressValue.d.ts +5 -8
- package/dist/composables/useProgressValue.js +6 -3
- package/dist/composables/useProgressValue.js.map +1 -1
- package/dist/composables/useRootAttrs.d.ts +12 -19
- package/dist/composables/useRootAttrs.js.map +1 -1
- package/dist/composables/useTimer.d.ts +8 -10
- package/dist/composables/useTimer.js.map +1 -1
- package/dist/i18n/en.d.ts +2 -10
- package/dist/i18n/en.js +18 -19
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/fr.d.ts +2 -18
- package/dist/i18n/fr.js +18 -19
- package/dist/i18n/fr.js.map +1 -1
- package/dist/i18n/state.d.ts +44 -47
- package/dist/i18n/state.js +20 -17
- package/dist/i18n/state.js.map +1 -1
- package/dist/i18n/types.d.ts +53 -44
- package/dist/icons.d.ts +3 -3
- package/dist/index.d.ts +43 -17
- package/dist/index.js +45 -44
- package/dist/styles.css +1 -1
- package/dist/tokens/css.js.map +1 -1
- package/dist/tokens/index.d.ts +5 -1
- package/dist/tokens/primitives.js.map +1 -1
- package/dist/tokens/semantic.d.ts +5 -1
- package/dist/tokens/semantic.js +6 -2
- package/dist/tokens/semantic.js.map +1 -1
- package/dist/tokens/themes/dark.js.map +1 -1
- package/dist/tokens/types.d.ts +7 -15
- package/dist/tokens/types.js.map +1 -1
- package/dist/tokens.json +25 -5
- package/dist/types.d.ts +24 -0
- package/dist/utils/array.d.ts +3 -6
- package/dist/utils/array.js.map +1 -1
- package/dist/utils/arrowNav.d.ts +17 -17
- package/dist/utils/arrowNav.js +5 -3
- package/dist/utils/arrowNav.js.map +1 -1
- package/dist/utils/chip.d.ts +11 -15
- package/dist/utils/chip.js.map +1 -1
- package/dist/utils/css.d.ts +22 -11
- package/dist/utils/css.js +5 -2
- package/dist/utils/css.js.map +1 -1
- package/dist/utils/date.d.ts +42 -19
- package/dist/utils/date.js +97 -98
- package/dist/utils/date.js.map +1 -1
- package/dist/utils/direction.d.ts +6 -12
- package/dist/utils/direction.js.map +1 -1
- package/dist/utils/env.d.ts +5 -6
- package/dist/utils/file.d.ts +46 -58
- package/dist/utils/file.js +43 -36
- package/dist/utils/file.js.map +1 -1
- package/dist/utils/focus.d.ts +8 -17
- package/dist/utils/focus.js.map +1 -1
- package/dist/utils/hostWarns.d.ts +12 -0
- package/dist/utils/hostWarns.js +6 -0
- package/dist/utils/hostWarns.js.map +1 -0
- package/dist/utils/ids.d.ts +10 -0
- package/dist/utils/ids.js +8 -0
- package/dist/utils/ids.js.map +1 -0
- package/dist/utils/matcher.d.ts +5 -9
- package/dist/utils/matcher.js.map +1 -1
- package/dist/utils/memo.d.ts +12 -0
- package/dist/utils/memo.js +9 -0
- package/dist/utils/memo.js.map +1 -0
- package/dist/utils/number.d.ts +3 -4
- package/dist/utils/number.js.map +1 -1
- package/dist/utils/text.d.ts +20 -9
- package/dist/utils/text.js +17 -3
- package/dist/utils/text.js.map +1 -1
- package/dist/utils/time.d.ts +53 -61
- package/dist/utils/time.js +49 -45
- package/dist/utils/time.js.map +1 -1
- package/dist/utils/vnode.d.ts +8 -15
- package/dist/utils/vnode.js.map +1 -1
- package/package.json +6 -6
- package/dist/components/VToggle/VToggleItem.css +0 -2
package/dist/utils/date.d.ts
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The date arithmetic behind VDatePicker and VDateInput,
|
|
3
|
-
*
|
|
2
|
+
* The date arithmetic behind VDatePicker and VDateInput, as pure functions. One currency
|
|
3
|
+
* throughout: the ISO `YYYY-MM-DD` string, computed in LOCAL time.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* zone, and `toISOString()`, which formats in UTC for the same reason. `Date`
|
|
10
|
-
* objects exist here only as an intermediate step, built with `new Date(y, m, d)` —
|
|
11
|
-
* local midnight — and turned back into text by concatenation.
|
|
5
|
+
* Two shortcuts are banned as a result. `new Date('YYYY-MM-DD')` parses as UTC and lands a
|
|
6
|
+
* day out depending on the zone, and `toISOString()` formats in UTC for the same reason.
|
|
7
|
+
* `Date` exists here only as an intermediate, built with `new Date(y, m, d)` — local
|
|
8
|
+
* midnight — and turned back into text by concatenation.
|
|
12
9
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* `timeZone: 'UTC'`, so that the resulting label never depends on the time zone of
|
|
16
|
-
* the machine doing the rendering.
|
|
10
|
+
* Month and day names come from `Intl` on REFERENCE dates pinned to `timeZone: 'UTC'`, so a
|
|
11
|
+
* label never depends on the rendering machine's zone and the server agrees with the browser.
|
|
17
12
|
*/
|
|
18
13
|
/**
|
|
19
14
|
* Tells whether a value is a real `YYYY-MM-DD` date. The shape alone is not enough:
|
|
@@ -73,10 +68,18 @@ export declare const isSameISO: (a: string | null, b: string | null) => boolean;
|
|
|
73
68
|
export declare function clampISO(iso: string, min?: string, max?: string): string;
|
|
74
69
|
/** Whether a date falls inside the allowed interval, each bound being optional. */
|
|
75
70
|
export declare function isWithin(iso: string, min?: string, max?: string): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Whether a date may be chosen: inside the bounds, and not one the matcher excludes. It is
|
|
73
|
+
* the ONE rule behind both a struck-through day in VDatePicker and a typed date VDateInput
|
|
74
|
+
* refuses, so the two cannot come to disagree about what "unavailable" means.
|
|
75
|
+
*/
|
|
76
|
+
export declare function isDateAllowed(iso: string, min: string | undefined, max: string | undefined, excluded: (iso: string) => boolean): boolean;
|
|
76
77
|
/** One square of a month grid. */
|
|
77
78
|
export interface MonthCell {
|
|
78
79
|
/** The day it stands for, as an ISO `YYYY-MM-DD` string. */
|
|
79
80
|
iso: string;
|
|
81
|
+
/** The day of the month, carried so a caller does not parse back what was just formatted. */
|
|
82
|
+
day: number;
|
|
80
83
|
/**
|
|
81
84
|
* Which side of the displayed month this day belongs to when it is not part of it,
|
|
82
85
|
* and `null` when it is.
|
|
@@ -90,14 +93,24 @@ export interface MonthCell {
|
|
|
90
93
|
* by a row. `firstDayOfWeek` runs from 0 for Sunday to 6 for Saturday.
|
|
91
94
|
*/
|
|
92
95
|
export declare function buildMonthGrid(year: number, month0: number, firstDayOfWeek: number): MonthCell[];
|
|
96
|
+
/**
|
|
97
|
+
* The day the week starts on in a given locale, from 0 for Sunday to 6 for Saturday
|
|
98
|
+
* — Sunday in the United States, Monday in most of Europe, Saturday in much of the
|
|
99
|
+
* Middle East. It comes from `Intl.Locale`, whose own numbering runs from 1 for
|
|
100
|
+
* Monday to 7 for Sunday.
|
|
101
|
+
*
|
|
102
|
+
* That part of `Intl` is not everywhere (some Node builds lack it), so the answer
|
|
103
|
+
* falls back to Monday when it is missing. A component can always override the
|
|
104
|
+
* result with its `firstDayOfWeek` prop.
|
|
105
|
+
*/
|
|
93
106
|
export declare function firstDayOfWeekFor(locale: string): number;
|
|
94
107
|
/**
|
|
95
108
|
* The names of the seven days, starting from `firstDayOfWeek` so the list can be
|
|
96
109
|
* dropped straight into a calendar header.
|
|
97
110
|
*/
|
|
98
|
-
export declare function weekdayNames(locale: string, firstDayOfWeek: number, weekday?: '
|
|
99
|
-
/** The names of the twelve months, in January-to-December order. */
|
|
100
|
-
export declare function monthNames(locale: string
|
|
111
|
+
export declare function weekdayNames(locale: string, firstDayOfWeek: number, weekday?: 'short' | 'long'): string[];
|
|
112
|
+
/** The full names of the twelve months, in January-to-December order. */
|
|
113
|
+
export declare function monthNames(locale: string): string[];
|
|
101
114
|
/**
|
|
102
115
|
* Month names shortened for the picker's narrow cells: a name of four characters or
|
|
103
116
|
* fewer is kept whole ("May", "June", "July"), a longer one is cut to three
|
|
@@ -106,14 +119,14 @@ export declare function monthNames(locale: string, month?: 'long' | 'short'): st
|
|
|
106
119
|
* one character and is never cut in half.
|
|
107
120
|
*/
|
|
108
121
|
export declare function monthNamesCompact(locale: string): string[];
|
|
109
|
-
/** The name of one month, 0 being January. */
|
|
110
|
-
export declare function monthName(locale: string, month0: number
|
|
122
|
+
/** The full name of one month, 0 being January. */
|
|
123
|
+
export declare function monthName(locale: string, month0: number): string;
|
|
111
124
|
/**
|
|
112
125
|
* A date written out for the reader, in the conventions of their locale — this is
|
|
113
126
|
* what VDateInput shows in its field. An unparsable date yields an empty string
|
|
114
127
|
* rather than a broken one.
|
|
115
128
|
*/
|
|
116
|
-
export declare function
|
|
129
|
+
export declare function formatDateDisplay(iso: string, locale: string, options: Intl.DateTimeFormatOptions): string;
|
|
117
130
|
/**
|
|
118
131
|
* A period written out for the reader. `Intl`'s own `formatRange` is what factors
|
|
119
132
|
* out the parts the two dates share, giving "19–26 June 2026" rather than the two
|
|
@@ -135,6 +148,16 @@ export interface DateMask {
|
|
|
135
148
|
/** How many digits the complete mask holds, which is always 8. */
|
|
136
149
|
size: number;
|
|
137
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* Works out how a date is typed in a given locale, by formatting a known date and
|
|
153
|
+
* looking at what came out.
|
|
154
|
+
*
|
|
155
|
+
* The calendar and the numbering system are FORCED to Gregorian and Latin digits.
|
|
156
|
+
* Without that, `fa-IR` answers with a Persian year (1400 rather than 2021) and
|
|
157
|
+
* `ar-EG` with Arabic-Indic digits — two things a numeric field could neither
|
|
158
|
+
* display nor read back. An invalid locale throws, and the answer then falls back to
|
|
159
|
+
* day/month/year separated by "/".
|
|
160
|
+
*/
|
|
138
161
|
export declare function dateMaskFor(locale: string): DateMask;
|
|
139
162
|
/**
|
|
140
163
|
* Lays a run of digits out as masked text. The separator appears AS SOON AS the field
|
package/dist/utils/date.js
CHANGED
|
@@ -1,113 +1,114 @@
|
|
|
1
1
|
import { digitsOf as e, pad2 as t } from "./text.js";
|
|
2
|
+
import { memo as n } from "./memo.js";
|
|
2
3
|
//#region src/utils/date.ts
|
|
3
|
-
var
|
|
4
|
-
function r(e) {
|
|
5
|
-
if (typeof e != "string" || !n.test(e)) return !1;
|
|
6
|
-
let t = i(e);
|
|
7
|
-
return t !== null && a(t) === e;
|
|
8
|
-
}
|
|
4
|
+
var r = /^\d{4}-\d{2}-\d{2}$/;
|
|
9
5
|
function i(e) {
|
|
10
|
-
if (typeof e != "string" || !
|
|
11
|
-
let t = e
|
|
12
|
-
return
|
|
6
|
+
if (typeof e != "string" || !r.test(e)) return !1;
|
|
7
|
+
let t = a(e);
|
|
8
|
+
return t !== null && o(t) === e;
|
|
13
9
|
}
|
|
14
10
|
function a(e) {
|
|
15
|
-
|
|
11
|
+
if (typeof e != "string" || !r.test(e)) return null;
|
|
12
|
+
let t = e.split("-"), n = new Date(Number(t[0]), Number(t[1]) - 1, Number(t[2]));
|
|
13
|
+
return Number.isNaN(n.getTime()) ? null : n;
|
|
16
14
|
}
|
|
17
|
-
function o(e
|
|
18
|
-
return
|
|
15
|
+
function o(e) {
|
|
16
|
+
return `${e.getFullYear()}-${t(e.getMonth() + 1)}-${t(e.getDate())}`;
|
|
19
17
|
}
|
|
20
|
-
function s(e, t) {
|
|
21
|
-
|
|
22
|
-
return n ? (n.setDate(n.getDate() + t), a(n)) : e;
|
|
18
|
+
function s(e, t, n) {
|
|
19
|
+
return o(new Date(e, t, n));
|
|
23
20
|
}
|
|
24
21
|
function c(e, t) {
|
|
25
|
-
let n =
|
|
22
|
+
let n = a(e);
|
|
23
|
+
return n ? (n.setDate(n.getDate() + t), o(n)) : e;
|
|
24
|
+
}
|
|
25
|
+
function l(e, t) {
|
|
26
|
+
let n = a(e);
|
|
26
27
|
if (!n) return e;
|
|
27
28
|
let r = n.getDate();
|
|
28
|
-
return n.setDate(1), n.setMonth(n.getMonth() + t), n.setDate(Math.min(r,
|
|
29
|
+
return n.setDate(1), n.setMonth(n.getMonth() + t), n.setDate(Math.min(r, u(n.getFullYear(), n.getMonth()))), o(n);
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
+
function u(e, t) {
|
|
31
32
|
return new Date(e, t + 1, 0).getDate();
|
|
32
33
|
}
|
|
33
|
-
function
|
|
34
|
+
function d(e, t) {
|
|
34
35
|
return e < t ? -1 : +(e > t);
|
|
35
36
|
}
|
|
36
|
-
var
|
|
37
|
-
function f(e, t, n) {
|
|
38
|
-
return t && u(e, t) < 0 ? t : n && u(e, n) > 0 ? n : e;
|
|
39
|
-
}
|
|
37
|
+
var f = (e, t) => !!e && e === t;
|
|
40
38
|
function p(e, t, n) {
|
|
41
|
-
return
|
|
39
|
+
return t && d(e, t) < 0 ? t : n && d(e, n) > 0 ? n : e;
|
|
42
40
|
}
|
|
43
41
|
function m(e, t, n) {
|
|
44
|
-
|
|
42
|
+
return !(t && d(e, t) < 0 || n && d(e, n) > 0);
|
|
43
|
+
}
|
|
44
|
+
function h(e, t, n, r) {
|
|
45
|
+
return m(e, t, n) && !r(e);
|
|
46
|
+
}
|
|
47
|
+
function g(e, t, n) {
|
|
48
|
+
let r = new Date(e, t, 1), i = (r.getDay() - n + 7) % 7, a = [];
|
|
45
49
|
for (let n = 0; n < 42; n++) {
|
|
46
|
-
let
|
|
47
|
-
|
|
48
|
-
iso:
|
|
50
|
+
let s = new Date(e, t, 1 - i + n), c = s.getMonth() === t && s.getFullYear() === e ? null : s < r ? "prev" : "next";
|
|
51
|
+
a.push({
|
|
52
|
+
iso: o(s),
|
|
53
|
+
day: s.getDate(),
|
|
49
54
|
adjacent: c
|
|
50
55
|
});
|
|
51
56
|
}
|
|
52
|
-
return
|
|
57
|
+
return a;
|
|
53
58
|
}
|
|
54
|
-
var
|
|
55
|
-
function
|
|
56
|
-
|
|
57
|
-
if (t !== void 0) return t;
|
|
58
|
-
let n = _(e);
|
|
59
|
-
return h.set(e, n), n;
|
|
59
|
+
var _ = /* @__PURE__ */ new Map();
|
|
60
|
+
function v(e) {
|
|
61
|
+
return n(_, e, () => y(e));
|
|
60
62
|
}
|
|
61
|
-
function
|
|
63
|
+
function y(e) {
|
|
62
64
|
try {
|
|
63
65
|
let t = new Intl.Locale(e), n = t.getWeekInfo?.() ?? t.weekInfo;
|
|
64
66
|
if (n?.firstDay) return n.firstDay % 7;
|
|
65
67
|
} catch {}
|
|
66
68
|
return 1;
|
|
67
69
|
}
|
|
68
|
-
var
|
|
69
|
-
function
|
|
70
|
+
var b = Date.UTC(2021, 7, 1), x = 864e5;
|
|
71
|
+
function S(e, t, n = "short") {
|
|
70
72
|
let r = new Intl.DateTimeFormat(e, {
|
|
71
73
|
weekday: n,
|
|
72
74
|
timeZone: "UTC"
|
|
73
75
|
});
|
|
74
|
-
return Array.from({ length: 7 }, (e, n) => r.format(
|
|
76
|
+
return Array.from({ length: 7 }, (e, n) => r.format(b + (t + n) % 7 * x));
|
|
75
77
|
}
|
|
76
|
-
function
|
|
77
|
-
let
|
|
78
|
-
month:
|
|
78
|
+
function C(e) {
|
|
79
|
+
let t = new Intl.DateTimeFormat(e, {
|
|
80
|
+
month: "long",
|
|
79
81
|
timeZone: "UTC"
|
|
80
82
|
});
|
|
81
|
-
return Array.from({ length: 12 }, (e,
|
|
83
|
+
return Array.from({ length: 12 }, (e, n) => t.format(Date.UTC(2021, n, 1)));
|
|
82
84
|
}
|
|
83
|
-
function
|
|
84
|
-
return
|
|
85
|
+
function w(e) {
|
|
86
|
+
return C(e).map((e) => {
|
|
85
87
|
let t = [...e];
|
|
86
88
|
return t.length <= 4 ? e : t.slice(0, 3).join("") + ".";
|
|
87
89
|
});
|
|
88
90
|
}
|
|
89
|
-
var
|
|
90
|
-
function
|
|
91
|
-
|
|
92
|
-
return r || (r = new Intl.DateTimeFormat(e, t), C.set(n, r)), r;
|
|
91
|
+
var T = /* @__PURE__ */ new Map();
|
|
92
|
+
function E(e, t) {
|
|
93
|
+
return n(T, `${e}|${JSON.stringify(t)}`, () => new Intl.DateTimeFormat(e, t));
|
|
93
94
|
}
|
|
94
|
-
function
|
|
95
|
-
return
|
|
96
|
-
month:
|
|
95
|
+
function D(e, t) {
|
|
96
|
+
return E(e, {
|
|
97
|
+
month: "long",
|
|
97
98
|
timeZone: "UTC"
|
|
98
99
|
}).format(Date.UTC(2021, t, 1));
|
|
99
100
|
}
|
|
100
|
-
function
|
|
101
|
-
let r =
|
|
102
|
-
return r ?
|
|
101
|
+
function O(e, t, n) {
|
|
102
|
+
let r = a(e);
|
|
103
|
+
return r ? E(t, n).format(r) : "";
|
|
103
104
|
}
|
|
104
|
-
function
|
|
105
|
-
let
|
|
106
|
-
if (!
|
|
107
|
-
let s =
|
|
108
|
-
return
|
|
105
|
+
function k(e, t, n, r) {
|
|
106
|
+
let i = a(e), o = a(t);
|
|
107
|
+
if (!i || !o) return "";
|
|
108
|
+
let s = E(n, r);
|
|
109
|
+
return d(e, t) === 0 ? s.format(i) : s.formatRange(i, o);
|
|
109
110
|
}
|
|
110
|
-
var
|
|
111
|
+
var A = {
|
|
111
112
|
order: [
|
|
112
113
|
"day",
|
|
113
114
|
"month",
|
|
@@ -120,14 +121,11 @@ var O = {
|
|
|
120
121
|
4
|
|
121
122
|
],
|
|
122
123
|
size: 8
|
|
123
|
-
},
|
|
124
|
-
function
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
return j.set(e, n), n;
|
|
129
|
-
}
|
|
130
|
-
function N(e) {
|
|
124
|
+
}, j = Date.UTC(2021, 10, 22), M = /[]/g, N = /* @__PURE__ */ new Map();
|
|
125
|
+
function P(e) {
|
|
126
|
+
return n(N, e, () => F(e));
|
|
127
|
+
}
|
|
128
|
+
function F(e) {
|
|
131
129
|
try {
|
|
132
130
|
let t = new Intl.DateTimeFormat(e, {
|
|
133
131
|
day: "2-digit",
|
|
@@ -136,7 +134,7 @@ function N(e) {
|
|
|
136
134
|
timeZone: "UTC",
|
|
137
135
|
calendar: "gregory",
|
|
138
136
|
numberingSystem: "latn"
|
|
139
|
-
}).formatToParts(
|
|
137
|
+
}).formatToParts(j), n = t.map((e) => e.type).filter((e) => e === "day" || e === "month" || e === "year"), r = t.findIndex((e) => e.type !== "literal"), i = t.slice(r).find((e) => e.type === "literal")?.value.replace(M, "").trim();
|
|
140
138
|
if (n.length === 3 && i) return {
|
|
141
139
|
order: n,
|
|
142
140
|
separator: i,
|
|
@@ -144,9 +142,9 @@ function N(e) {
|
|
|
144
142
|
size: 8
|
|
145
143
|
};
|
|
146
144
|
} catch {}
|
|
147
|
-
return
|
|
145
|
+
return A;
|
|
148
146
|
}
|
|
149
|
-
function
|
|
147
|
+
function I(t, n) {
|
|
150
148
|
let r = e(t).slice(0, n.size), i = "", a = 0;
|
|
151
149
|
for (let e = 0; e < n.lengths.length; e++) {
|
|
152
150
|
let t = n.lengths[e], o = r.slice(a, a + t);
|
|
@@ -155,29 +153,29 @@ function P(t, n) {
|
|
|
155
153
|
}
|
|
156
154
|
return i;
|
|
157
155
|
}
|
|
158
|
-
function
|
|
159
|
-
if (!
|
|
160
|
-
let [n,
|
|
156
|
+
function L(e, t) {
|
|
157
|
+
if (!i(e)) return "";
|
|
158
|
+
let [n, r, a] = e.split("-"), o = {
|
|
161
159
|
year: n,
|
|
162
|
-
month:
|
|
160
|
+
month: r,
|
|
163
161
|
day: a
|
|
164
162
|
};
|
|
165
|
-
return
|
|
163
|
+
return I(t.order.map((e) => o[e]).join(""), t);
|
|
166
164
|
}
|
|
167
|
-
function
|
|
165
|
+
function R(t, n, r = {}) {
|
|
168
166
|
let a = e(t), o = {}, s = 0;
|
|
169
167
|
for (let e = 0; e < n.order.length; e++) {
|
|
170
|
-
let t = n.order[e],
|
|
171
|
-
if (c.length ===
|
|
172
|
-
else if (t === "year" &&
|
|
168
|
+
let t = n.order[e], i = n.lengths[e], c = a.slice(s, s + i);
|
|
169
|
+
if (c.length === i) s += i;
|
|
170
|
+
else if (t === "year" && r.yearPivot !== void 0 && e === n.order.length - 1 && c.length === 2) s += 2;
|
|
173
171
|
else return null;
|
|
174
172
|
o[t] = c;
|
|
175
173
|
}
|
|
176
174
|
if (s !== a.length) return null;
|
|
177
|
-
let c = `${o.year.length === 2 ? String(
|
|
178
|
-
return
|
|
175
|
+
let c = `${o.year.length === 2 ? String(r.yearPivot + Number(o.year)) : o.year}-${o.month}-${o.day}`;
|
|
176
|
+
return i(c) ? c : null;
|
|
179
177
|
}
|
|
180
|
-
function
|
|
178
|
+
function z(e, t, n) {
|
|
181
179
|
let r = 0;
|
|
182
180
|
if (t > 0) {
|
|
183
181
|
r = e.length;
|
|
@@ -192,34 +190,35 @@ function L(e, t, n) {
|
|
|
192
190
|
}
|
|
193
191
|
return n && e.startsWith(n, r) && (r += n.length), r;
|
|
194
192
|
}
|
|
195
|
-
var
|
|
193
|
+
var B = {
|
|
196
194
|
day: "d",
|
|
197
195
|
month: "m",
|
|
198
196
|
year: "y"
|
|
199
|
-
},
|
|
200
|
-
function
|
|
201
|
-
let n =
|
|
197
|
+
}, V = /[\p{sc=Han}\p{sc=Hangul}\p{sc=Hiragana}\p{sc=Katakana}]/u;
|
|
198
|
+
function H(e, t) {
|
|
199
|
+
let n = W(e);
|
|
202
200
|
return t.order.map((e, r) => n[e].repeat(t.lengths[r])).join(t.separator);
|
|
203
201
|
}
|
|
204
|
-
var
|
|
205
|
-
function
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
202
|
+
var U = /* @__PURE__ */ new Map();
|
|
203
|
+
function W(e) {
|
|
204
|
+
return n(U, e, () => G(e));
|
|
205
|
+
}
|
|
206
|
+
function G(e) {
|
|
207
|
+
let t = { ...B };
|
|
209
208
|
try {
|
|
210
|
-
let
|
|
209
|
+
let n = new Intl.DisplayNames(e, { type: "dateTimeField" });
|
|
211
210
|
for (let r of [
|
|
212
211
|
"day",
|
|
213
212
|
"month",
|
|
214
213
|
"year"
|
|
215
214
|
]) {
|
|
216
|
-
let i = [...
|
|
217
|
-
i && /\p{L}/u.test(i) && !
|
|
215
|
+
let i = [...n.of(r) ?? ""][0];
|
|
216
|
+
i && /\p{L}/u.test(i) && !V.test(i) && (t[r] = i.toLocaleLowerCase(e));
|
|
218
217
|
}
|
|
219
218
|
} catch {}
|
|
220
|
-
return
|
|
219
|
+
return t;
|
|
221
220
|
}
|
|
222
221
|
//#endregion
|
|
223
|
-
export {
|
|
222
|
+
export { c as addDays, l as addMonths, g as buildMonthGrid, z as caretAfterDigits, p as clampISO, d as compareISO, P as dateMaskFor, u as daysInMonth, v as firstDayOfWeekFor, O as formatDateDisplay, I as formatDateMask, k as formatDisplayRange, o as formatISO, h as isDateAllowed, f as isSameISO, i as isValidISO, m as isWithin, s as isoOf, L as isoToMask, H as maskPlaceholder, D as monthName, C as monthNames, w as monthNamesCompact, R as parseDateMask, a as parseISO, S as weekdayNames };
|
|
224
223
|
|
|
225
224
|
//# sourceMappingURL=date.js.map
|
package/dist/utils/date.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.js","names":[],"sources":["../../src/utils/date.ts"],"sourcesContent":["// @ssr @core — module-wide: every export below is @core unless tagged otherwise.\n/**\n * The date arithmetic behind VDatePicker and VDateInput, written as pure functions:\n * they read nothing outside their arguments and change nothing around them.\n *\n * The whole module speaks one language, the ISO `YYYY-MM-DD` string, and computes\n * everything in the reader's LOCAL time. Two shortcuts are therefore banned\n * throughout: `new Date('YYYY-MM-DD')`, which the language interprets as UTC and\n * which consequently lands on the previous or the next day depending on the time\n * zone, and `toISOString()`, which formats in UTC for the same reason. `Date`\n * objects exist here only as an intermediate step, built with `new Date(y, m, d)` —\n * local midnight — and turned back into text by concatenation.\n *\n * The names of months and days come from `Intl`, which is available on the server as\n * well as in the browser. They are formatted from REFERENCE dates pinned to\n * `timeZone: 'UTC'`, so that the resulting label never depends on the time zone of\n * the machine doing the rendering.\n */\n\nimport { digitsOf, pad2 } from './text'\n\nconst ISO_RE = /^\\d{4}-\\d{2}-\\d{2}$/\n\n/**\n * Tells whether a value is a real `YYYY-MM-DD` date. The shape alone is not enough:\n * `2026-02-31` matches the pattern, so the check goes through a parse and a\n * reformat, and only a value that survives the round trip unchanged is accepted.\n */\nexport function isValidISO(iso: unknown): iso is string {\n if (typeof iso !== 'string' || !ISO_RE.test(iso)) return false\n const d = parseISO(iso)\n return d !== null && formatISO(d) === iso\n}\n\n/**\n * Turns an ISO string into a `Date` set at local midnight, or returns `null` when\n * the string is not one. Every caller here has to handle that `null`: the bounds a\n * consumer passes are raw strings and may be anything.\n */\nexport function parseISO(iso: string | null | undefined): Date | null {\n if (typeof iso !== 'string' || !ISO_RE.test(iso)) return null\n const parts = iso.split('-')\n const date = new Date(Number(parts[0]), Number(parts[1]) - 1, Number(parts[2]))\n return Number.isNaN(date.getTime()) ? null : date\n}\n\n/**\n * Writes a `Date` as an ISO string, reading its LOCAL components. This manual\n * concatenation is what `toISOString()` cannot do, since that one formats in UTC.\n */\nexport function formatISO(date: Date): string {\n return `${date.getFullYear()}-${pad2(date.getMonth() + 1)}-${pad2(date.getDate())}`\n}\n\n/**\n * Builds an ISO string from separate values. The month is 0-indexed, as everywhere\n * in the language: 0 is January.\n */\nexport function isoOf(year: number, month0: number, day: number): string {\n return formatISO(new Date(year, month0, day))\n}\n\n/**\n * Moves a date by a number of days, forwards or backwards. Crossing into another\n * month or year is handled by `Date` itself.\n */\nexport function addDays(iso: string, n: number): string {\n const d = parseISO(iso)\n if (!d) return iso\n d.setDate(d.getDate() + n)\n return formatISO(d)\n}\n\n/**\n * Moves a date by a number of months, keeping the day of the month where possible.\n * When the target month is too short the day is brought back to its last one: 31\n * January plus one month gives 28 or 29 February, and never spills over into March\n * the way a naive addition would.\n */\nexport function addMonths(iso: string, n: number): string {\n const d = parseISO(iso)\n if (!d) return iso\n const day = d.getDate()\n d.setDate(1)\n d.setMonth(d.getMonth() + n)\n d.setDate(Math.min(day, daysInMonth(d.getFullYear(), d.getMonth())))\n return formatISO(d)\n}\n\n/**\n * How many days the given month holds, leap years included. Day 0 of the following\n * month is the last day of this one, which is what makes the leap year rule the\n * language's problem rather than ours.\n */\nexport function daysInMonth(year: number, month0: number): number {\n return new Date(year, month0 + 1, 0).getDate()\n}\n\n/**\n * Compares two dates chronologically, returning the usual -1, 0 or 1. Because the\n * `YYYY-MM-DD` format puts its most significant part first, comparing the strings as\n * text already gives the chronological order: no parsing is needed.\n */\nexport function compareISO(a: string, b: string): number {\n return a < b ? -1 : a > b ? 1 : 0\n}\n\n/**\n * Whether two dates are the same day, with a null on either side counting as no\n * date at all rather than as a match.\n */\nexport const isSameISO = (a: string | null, b: string | null) => !!a && a === b\n\n/**\n * Brings a date back inside the allowed interval, returning the bound it exceeded.\n * Both bounds are optional, and an absent one means unbounded on that side.\n */\nexport function clampISO(iso: string, min?: string, max?: string): string {\n if (min && compareISO(iso, min) < 0) return min\n if (max && compareISO(iso, max) > 0) return max\n return iso\n}\n\n/** Whether a date falls inside the allowed interval, each bound being optional. */\nexport function isWithin(iso: string, min?: string, max?: string): boolean {\n if (min && compareISO(iso, min) < 0) return false\n if (max && compareISO(iso, max) > 0) return false\n return true\n}\n\n/** One square of a month grid. */\nexport interface MonthCell {\n /** The day it stands for, as an ISO `YYYY-MM-DD` string. */\n iso: string\n /**\n * Which side of the displayed month this day belongs to when it is not part of it,\n * and `null` when it is.\n */\n adjacent: 'prev' | 'next' | null\n}\n\n/**\n * Builds the grid of a month: 42 cells, six rows of seven, filled out at both ends\n * with the days of the neighbouring months. The count is fixed on purpose, so that\n * the calendar keeps the same height from one month to the next instead of jumping\n * by a row. `firstDayOfWeek` runs from 0 for Sunday to 6 for Saturday.\n */\nexport function buildMonthGrid(year: number, month0: number, firstDayOfWeek: number): MonthCell[] {\n const first = new Date(year, month0, 1)\n // How many cells the 1st of the month sits after the start of its row, which is\n // exactly how many days of the previous month the grid has to open with.\n const offset = (first.getDay() - firstDayOfWeek + 7) % 7\n const cells: MonthCell[] = []\n const start = new Date(year, month0, 1 - offset)\n for (let i = 0; i < 42; i++) {\n const d = new Date(start.getFullYear(), start.getMonth(), start.getDate() + i)\n const adjacent =\n d.getMonth() === month0 && d.getFullYear() === year\n ? null\n : compareISO(formatISO(d), formatISO(first)) < 0\n ? 'prev'\n : 'next'\n cells.push({ iso: formatISO(d), adjacent })\n }\n return cells\n}\n\n// @fallback @ssr\n/**\n * The day the week starts on in a given locale, from 0 for Sunday to 6 for Saturday\n * — Sunday in the United States, Monday in most of Europe, Saturday in much of the\n * Middle East. It comes from `Intl.Locale`, whose own numbering runs from 1 for\n * Monday to 7 for Sunday.\n *\n * That part of `Intl` is not everywhere (some Node builds lack it), so the answer\n * falls back to Monday when it is missing. A component can always override the\n * result with its `firstDayOfWeek` prop.\n */\nconst firstDayCache = new Map<string, number>()\n\nexport function firstDayOfWeekFor(locale: string): number {\n const cached = firstDayCache.get(locale)\n if (cached !== undefined) return cached\n const first = resolveFirstDayOfWeek(locale)\n firstDayCache.set(locale, first)\n return first\n}\n\nfunction resolveFirstDayOfWeek(locale: string): number {\n try {\n // Implementations disagree on the shape: Chrome and Safari expose `weekInfo` as\n // a getter, others a `getWeekInfo()` method. Both are tried.\n const loc = new Intl.Locale(locale) as Intl.Locale & {\n weekInfo?: { firstDay: number }\n getWeekInfo?: () => { firstDay: number }\n }\n const info = loc.getWeekInfo?.() ?? loc.weekInfo\n if (info?.firstDay) return info.firstDay % 7 // brings Sunday, their 7, back to 0\n } catch {\n /* an invalid locale throws a RangeError: fall through to the fallback */\n }\n return 1 // Monday\n}\n\n// The reference instants the names are formatted from. Any Sunday will do for the\n// weekdays, and any year for the months; combined with `timeZone: 'UTC'` at every\n// call site, they pin the output whatever zone the machine is in.\nconst REF_SUNDAY = Date.UTC(2021, 7, 1) // 1 August 2021 fell on a Sunday\nconst MS_DAY = 86_400_000\n\n/**\n * The names of the seven days, starting from `firstDayOfWeek` so the list can be\n * dropped straight into a calendar header.\n */\nexport function weekdayNames(\n locale: string,\n firstDayOfWeek: number,\n weekday: 'narrow' | 'short' | 'long' = 'short',\n): string[] {\n const fmt = new Intl.DateTimeFormat(locale, { weekday, timeZone: 'UTC' })\n return Array.from({ length: 7 }, (_, i) =>\n fmt.format(REF_SUNDAY + ((firstDayOfWeek + i) % 7) * MS_DAY),\n )\n}\n\n/** The names of the twelve months, in January-to-December order. */\nexport function monthNames(locale: string, month: 'long' | 'short' = 'long'): string[] {\n const fmt = new Intl.DateTimeFormat(locale, { month, timeZone: 'UTC' })\n return Array.from({ length: 12 }, (_, i) => fmt.format(Date.UTC(2021, i, 1)))\n}\n\n/**\n * Month names shortened for the picker's narrow cells: a name of four characters or\n * fewer is kept whole (\"May\", \"June\", \"July\"), a longer one is cut to three\n * characters followed by a dot (\"January\" becomes \"Jan.\"). The name is spread with\n * `[...n]` rather than indexed, so that an accented or non-Latin character counts as\n * one character and is never cut in half.\n */\nexport function monthNamesCompact(locale: string): string[] {\n return monthNames(locale, 'long').map((n) => {\n const chars = [...n]\n return chars.length <= 4 ? n : chars.slice(0, 3).join('') + '.'\n })\n}\n\n/**\n * One formatter kept per locale and set of options, for the lifetime of the module —\n * the same `formatterFor` idiom as in `utils/file.ts` and `utils/time.ts`.\n *\n * Building an `Intl.DateTimeFormat` costs one to two orders of magnitude more than\n * using one, and the three functions below are called ONE VALUE AT A TIME: VDateInput\n * formats a multiple selection inside a `.map`, so a fresh formatter would be built\n * for every date. `weekdayNames` and `monthNames` already hoist theirs out of their\n * loop; this cache gives the per-call functions the same property.\n *\n * The options object is part of the cache key. `JSON.stringify` is stable enough\n * here — these objects are literals written by the components, not data coming from\n * a user — and costs a fraction of a construction.\n */\nconst formatters = new Map<string, Intl.DateTimeFormat>()\n\nfunction formatterFor(locale: string, options: Intl.DateTimeFormatOptions): Intl.DateTimeFormat {\n const key = `${locale}|${JSON.stringify(options)}`\n let formatter = formatters.get(key)\n if (!formatter) {\n formatter = new Intl.DateTimeFormat(locale, options)\n formatters.set(key, formatter)\n }\n return formatter\n}\n\n/** The name of one month, 0 being January. */\nexport function monthName(\n locale: string,\n month0: number,\n month: 'long' | 'short' = 'long',\n): string {\n return formatterFor(locale, { month, timeZone: 'UTC' }).format(Date.UTC(2021, month0, 1))\n}\n\n/**\n * A date written out for the reader, in the conventions of their locale — this is\n * what VDateInput shows in its field. An unparsable date yields an empty string\n * rather than a broken one.\n */\nexport function formatDisplay(\n iso: string,\n locale: string,\n options: Intl.DateTimeFormatOptions,\n): string {\n const d = parseISO(iso)\n return d ? formatterFor(locale, options).format(d) : ''\n}\n\n/**\n * A period written out for the reader. `Intl`'s own `formatRange` is what factors\n * out the parts the two dates share, giving \"19–26 June 2026\" rather than the two\n * full dates side by side. A period of a single day is formatted as that one date.\n */\nexport function formatDisplayRange(\n start: string,\n end: string,\n locale: string,\n options: Intl.DateTimeFormatOptions,\n): string {\n const a = parseISO(start)\n const b = parseISO(end)\n if (!a || !b) return ''\n const fmt = formatterFor(locale, options)\n return compareISO(start, end) === 0 ? fmt.format(a) : fmt.formatRange(a, b)\n}\n\n/*\n * The numeric input mask, used by VDateInput when its field can be typed into.\n *\n * A field being typed into never shows the long display format — \"10 June 2026\" is\n * not something one can type — but a purely numeric mask instead. The order of the\n * three fields and the separator between them are DERIVED from the locale rather\n * than hardcoded, which is what makes the same field work for a reader in Tokyo and\n * one in Chicago.\n */\n\nexport type DateMaskField = 'day' | 'month' | 'year'\n\n/** Everything a locale decides about how a date is typed. */\nexport interface DateMask {\n /**\n * The order the three fields appear in: day, month, year in the United Kingdom,\n * month, day, year in the United States, year, month, day in Japan.\n */\n order: readonly DateMaskField[]\n /** The single character between two fields, stripped of bidi marks and spaces. */\n separator: string\n /** How many digits each field takes, in the same order: 4 for the year, 2 otherwise. */\n lengths: readonly number[]\n /** How many digits the complete mask holds, which is always 8. */\n size: number\n}\n\nconst MASK_FALLBACK: DateMask = {\n order: ['day', 'month', 'year'],\n separator: '/',\n lengths: [2, 2, 4],\n size: 8,\n}\n\n/**\n * The date the mask is read from: 22 November 2021. Its three numbers all differ, so\n * whichever order the locale prints them in, each one can be told apart.\n */\nconst REF_MASK_DATE = Date.UTC(2021, 10, 22)\n\n/** The invisible direction marks some locales insert, such as U+200F before \"/\" in ar-EG. */\nconst BIDI_MARKS = /[]/g\n\n/**\n * Works out how a date is typed in a given locale, by formatting a known date and\n * looking at what came out.\n *\n * The calendar and the numbering system are FORCED to Gregorian and Latin digits.\n * Without that, `fa-IR` answers with a Persian year (1400 rather than 2021) and\n * `ar-EG` with Arabic-Indic digits — two things a numeric field could neither\n * display nor read back. An invalid locale throws, and the answer then falls back to\n * day/month/year separated by \"/\".\n */\nconst maskCache = new Map<string, DateMask>()\n\nexport function dateMaskFor(locale: string): DateMask {\n const cached = maskCache.get(locale)\n if (cached) return cached\n const mask = buildDateMask(locale)\n maskCache.set(locale, mask)\n return mask\n}\n\n/*\n * TRAP — the returned `DateMask` is SHARED between every caller for a locale, so it must be\n * treated as read-only. Nothing mutates it today (it is read field by field in\n * `formatDateMask`, `parseDateMask` and `maskPlaceholder`), and it is the same contract the\n * memoized `Intl` formatters in this file already have.\n */\nfunction buildDateMask(locale: string): DateMask {\n try {\n const parts = new Intl.DateTimeFormat(locale, {\n day: '2-digit',\n month: '2-digit',\n year: 'numeric',\n timeZone: 'UTC',\n calendar: 'gregory',\n numberingSystem: 'latn',\n }).formatToParts(REF_MASK_DATE)\n\n const order = parts\n .map((p) => p.type)\n .filter((t): t is DateMaskField => t === 'day' || t === 'month' || t === 'year')\n\n // The separator is the first literal appearing AFTER the first field, and not\n // simply the first literal: Hungarian and Korean end the whole format with a dot\n // (\"2021. 11. 22.\"), which must not be mistaken for it.\n const firstField = parts.findIndex((p) => p.type !== 'literal')\n const separator = parts\n .slice(firstField)\n .find((p) => p.type === 'literal')\n ?.value.replace(BIDI_MARKS, '')\n .trim()\n\n if (order.length === 3 && separator) {\n const lengths = order.map((f) => (f === 'year' ? 4 : 2))\n return { order, separator, lengths, size: 8 }\n }\n } catch {\n /* an invalid locale throws a RangeError: fall through to the fallback */\n }\n return MASK_FALLBACK\n}\n\n/**\n * Lays a run of digits out as masked text. The separator appears AS SOON AS the field\n * before it is full — typing \"22\" already gives \"22/\" — so the reader sees their\n * progress without ever having to type a separator themselves.\n *\n * This has a consequence the component must honour: pressing Backspace on such a\n * separator has to delete the DIGIT before it. Deleting the separator alone would\n * see the mask write it straight back, and the key would look dead.\n */\nexport function formatDateMask(digits: string, mask: DateMask): string {\n const all = digitsOf(digits).slice(0, mask.size)\n let out = ''\n let i = 0\n for (let f = 0; f < mask.lengths.length; f++) {\n const len = mask.lengths[f] as number\n const chunk = all.slice(i, i + len)\n if (!chunk) break\n out += chunk\n i += len\n if (chunk.length < len) break // this field is still being typed: no separator yet\n if (f < mask.lengths.length - 1) out += mask.separator\n }\n return out\n}\n\n/**\n * Writes an ISO date in the mask of the locale, ready to be put in the field: the\n * same day reads \"10/06/2026\" in London and \"06/10/2026\" in Chicago.\n */\nexport function isoToMask(iso: string, mask: DateMask): string {\n if (!isValidISO(iso)) return ''\n const [year, month, day] = iso.split('-') as [string, string, string]\n const by: Record<DateMaskField, string> = { year, month, day }\n return formatDateMask(mask.order.map((f) => by[f]).join(''), mask)\n}\n\nexport interface ParseMaskOptions {\n /**\n * The century a two-digit year is expanded into: with 2000, \"10/06/26\" is read as\n * 2026. It is only accepted when the year is the LAST field of the mask, since\n * elsewhere the following separator already tells the two apart.\n *\n * Leaving it out refuses any year shorter than four digits, and that is the mode\n * used while the reader types — so that \"26\", passed through on the way to \"2026\",\n * is never committed as a year of its own.\n */\n yearPivot?: number\n}\n\n/**\n * Reads masked text back into an ISO date, or returns `null` when the text is\n * incomplete, holds too many digits, or names a day that does not exist — 31\n * February passes every length check and is caught by the round trip `isValidISO`\n * performs.\n *\n * Whether the resulting date is allowed is a different question: the `min`/`max`\n * bounds and the disabled dates belong to the component, and this function knows\n * nothing about props.\n */\nexport function parseDateMask(\n text: string,\n mask: DateMask,\n options: ParseMaskOptions = {},\n): string | null {\n const digits = digitsOf(text)\n const by: Partial<Record<DateMaskField, string>> = {}\n let i = 0\n for (let k = 0; k < mask.order.length; k++) {\n const field = mask.order[k] as DateMaskField\n const len = mask.lengths[k] as number\n const chunk = digits.slice(i, i + len)\n if (chunk.length === len) i += len\n else if (\n field === 'year' &&\n options.yearPivot !== undefined &&\n k === mask.order.length - 1 &&\n chunk.length === 2\n )\n i += 2\n else return null\n by[field] = chunk\n }\n if (i !== digits.length) return null // digits are left over: the entry is too long\n const year =\n (by.year as string).length === 2\n ? String((options.yearPivot as number) + Number(by.year))\n : (by.year as string)\n const iso = `${year}-${by.month}-${by.day}`\n return isValidISO(iso) ? iso : null\n}\n\n/**\n * Where the caret has to go to sit just after the nth digit. Counting digits is the\n * only landmark that survives a reformat: an absolute position jumps by one the\n * moment a separator appears or disappears, so restoring it would leave the caret in\n * the wrong place on exactly the keystrokes that matter.\n *\n * When a separator is passed and it directly follows that position, the caret steps\n * over it: while typing, it must land in the NEXT field rather than in front of a\n * separator that has just been written. On deletion the argument is omitted, so the\n * caret stays before it and the next Backspace reaches the digit.\n */\nexport function caretAfterDigits(text: string, n: number, separator?: string): number {\n let pos = 0\n if (n > 0) {\n pos = text.length\n let seen = 0\n for (let i = 0; i < text.length; i++) {\n const code = text.charCodeAt(i)\n if (code >= 48 && code <= 57 && ++seen === n) {\n pos = i + 1\n break\n }\n }\n }\n if (separator && text.startsWith(separator, pos)) pos += separator.length\n return pos\n}\n\nconst PLACEHOLDER_FALLBACK: Record<DateMaskField, string> = { day: 'd', month: 'm', year: 'y' }\n\n/**\n * Ideographic scripts, which are excluded from the placeholder: a repeated \"日\" does\n * not read as a template the way a repeated letter does.\n */\nconst IDEOGRAPHIC = /[\\p{sc=Han}\\p{sc=Hangul}\\p{sc=Hiragana}\\p{sc=Katakana}]/u\n\n// @fallback\n/**\n * The empty template shown in the field: \"dd/mm/yyyy\" in English, \"jj/mm/aaaa\" in\n * French, \"tt.mm.jjjj\" in German, \"дд/мм/гггг\" in Russian.\n *\n * Each letter is the first letter of the field's own name in that language, taken\n * from `Intl.DisplayNames` — which lands on the attested convention of every\n * alphabetic script without a table to maintain. It falls back to the Latin letters\n * when that part of `Intl` is missing, or when the script is ideographic and the\n * repetition would mean nothing.\n */\nexport function maskPlaceholder(locale: string, mask: DateMask): string {\n const letters = placeholderLetters(locale)\n return mask.order.map((f, k) => letters[f].repeat(mask.lengths[k] as number)).join(mask.separator)\n}\n\n/**\n * The three letters a locale writes its date fields with, worked out once per locale.\n *\n * It is the LETTERS that are cached and not the finished placeholder, because the result\n * also depends on the mask handed in — caching the string would be wrong the moment a\n * caller passes a mask that is not `dateMaskFor(locale)`. All of the cost is here anyway:\n * `Intl.DisplayNames` is the most expensive constructor in this file by an order of\n * magnitude (measured at ~0.22 ms a call, against ~0.07 for `dateMaskFor`), and the string\n * assembly below it is a handful of `repeat` calls.\n */\nconst placeholderLetterCache = new Map<string, typeof PLACEHOLDER_FALLBACK>()\n\nfunction placeholderLetters(locale: string): typeof PLACEHOLDER_FALLBACK {\n const cached = placeholderLetterCache.get(locale)\n if (cached) return cached\n\n const letters = { ...PLACEHOLDER_FALLBACK }\n try {\n const names = new Intl.DisplayNames(locale, { type: 'dateTimeField' })\n for (const field of ['day', 'month', 'year'] as const) {\n const first = [...(names.of(field) ?? '')][0]\n if (first && /\\p{L}/u.test(first) && !IDEOGRAPHIC.test(first))\n letters[field] = first.toLocaleLowerCase(locale)\n }\n } catch {\n /* Intl.DisplayNames is unavailable here: keep the Latin letters */\n }\n placeholderLetterCache.set(locale, letters)\n return letters\n}\n"],"mappings":";;AAqBA,IAAM,IAAS;AAOf,SAAgB,EAAW,GAA6B;CACtD,IAAI,OAAO,KAAQ,YAAY,CAAC,EAAO,KAAK,CAAG,GAAG,OAAO;CACzD,IAAM,IAAI,EAAS,CAAG;CACtB,OAAO,MAAM,QAAQ,EAAU,CAAC,MAAM;AACxC;AAOA,SAAgB,EAAS,GAA6C;CACpE,IAAI,OAAO,KAAQ,YAAY,CAAC,EAAO,KAAK,CAAG,GAAG,OAAO;CACzD,IAAM,IAAQ,EAAI,MAAM,GAAG,GACrB,IAAO,IAAI,KAAK,OAAO,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IAAI,GAAQ,CAAO,GACnC;AACT"}
|
|
1
|
+
{"version":3,"file":"date.js","names":[],"sources":["../../src/utils/date.ts"],"sourcesContent":["// @ssr @core — module-wide: every export below is @core unless tagged otherwise.\n/**\n * The date arithmetic behind VDatePicker and VDateInput, as pure functions. One currency\n * throughout: the ISO `YYYY-MM-DD` string, computed in LOCAL time.\n *\n * Two shortcuts are banned as a result. `new Date('YYYY-MM-DD')` parses as UTC and lands a\n * day out depending on the zone, and `toISOString()` formats in UTC for the same reason.\n * `Date` exists here only as an intermediate, built with `new Date(y, m, d)` — local\n * midnight — and turned back into text by concatenation.\n *\n * Month and day names come from `Intl` on REFERENCE dates pinned to `timeZone: 'UTC'`, so a\n * label never depends on the rendering machine's zone and the server agrees with the browser.\n */\n\nimport { memo } from './memo'\nimport { digitsOf, pad2 } from './text'\n\nconst ISO_RE = /^\\d{4}-\\d{2}-\\d{2}$/\n\n/**\n * Tells whether a value is a real `YYYY-MM-DD` date. The shape alone is not enough:\n * `2026-02-31` matches the pattern, so the check goes through a parse and a\n * reformat, and only a value that survives the round trip unchanged is accepted.\n */\nexport function isValidISO(iso: unknown): iso is string {\n if (typeof iso !== 'string' || !ISO_RE.test(iso)) return false\n const d = parseISO(iso)\n return d !== null && formatISO(d) === iso\n}\n\n/**\n * Turns an ISO string into a `Date` set at local midnight, or returns `null` when\n * the string is not one. Every caller here has to handle that `null`: the bounds a\n * consumer passes are raw strings and may be anything.\n */\nexport function parseISO(iso: string | null | undefined): Date | null {\n if (typeof iso !== 'string' || !ISO_RE.test(iso)) return null\n const parts = iso.split('-')\n const date = new Date(Number(parts[0]), Number(parts[1]) - 1, Number(parts[2]))\n return Number.isNaN(date.getTime()) ? null : date\n}\n\n/**\n * Writes a `Date` as an ISO string, reading its LOCAL components. This manual\n * concatenation is what `toISOString()` cannot do, since that one formats in UTC.\n */\nexport function formatISO(date: Date): string {\n return `${date.getFullYear()}-${pad2(date.getMonth() + 1)}-${pad2(date.getDate())}`\n}\n\n/**\n * Builds an ISO string from separate values. The month is 0-indexed, as everywhere\n * in the language: 0 is January.\n */\nexport function isoOf(year: number, month0: number, day: number): string {\n return formatISO(new Date(year, month0, day))\n}\n\n/**\n * Moves a date by a number of days, forwards or backwards. Crossing into another\n * month or year is handled by `Date` itself.\n */\nexport function addDays(iso: string, n: number): string {\n const d = parseISO(iso)\n if (!d) return iso\n d.setDate(d.getDate() + n)\n return formatISO(d)\n}\n\n/**\n * Moves a date by a number of months, keeping the day of the month where possible.\n * When the target month is too short the day is brought back to its last one: 31\n * January plus one month gives 28 or 29 February, and never spills over into March\n * the way a naive addition would.\n */\nexport function addMonths(iso: string, n: number): string {\n const d = parseISO(iso)\n if (!d) return iso\n const day = d.getDate()\n d.setDate(1)\n d.setMonth(d.getMonth() + n)\n d.setDate(Math.min(day, daysInMonth(d.getFullYear(), d.getMonth())))\n return formatISO(d)\n}\n\n/**\n * How many days the given month holds, leap years included. Day 0 of the following\n * month is the last day of this one, which is what makes the leap year rule the\n * language's problem rather than ours.\n */\nexport function daysInMonth(year: number, month0: number): number {\n return new Date(year, month0 + 1, 0).getDate()\n}\n\n/**\n * Compares two dates chronologically, returning the usual -1, 0 or 1. Because the\n * `YYYY-MM-DD` format puts its most significant part first, comparing the strings as\n * text already gives the chronological order: no parsing is needed.\n */\nexport function compareISO(a: string, b: string): number {\n return a < b ? -1 : a > b ? 1 : 0\n}\n\n/**\n * Whether two dates are the same day, with a null on either side counting as no\n * date at all rather than as a match.\n */\nexport const isSameISO = (a: string | null, b: string | null) => !!a && a === b\n\n/**\n * Brings a date back inside the allowed interval, returning the bound it exceeded.\n * Both bounds are optional, and an absent one means unbounded on that side.\n */\nexport function clampISO(iso: string, min?: string, max?: string): string {\n if (min && compareISO(iso, min) < 0) return min\n if (max && compareISO(iso, max) > 0) return max\n return iso\n}\n\n/** Whether a date falls inside the allowed interval, each bound being optional. */\nexport function isWithin(iso: string, min?: string, max?: string): boolean {\n if (min && compareISO(iso, min) < 0) return false\n if (max && compareISO(iso, max) > 0) return false\n return true\n}\n\n/**\n * Whether a date may be chosen: inside the bounds, and not one the matcher excludes. It is\n * the ONE rule behind both a struck-through day in VDatePicker and a typed date VDateInput\n * refuses, so the two cannot come to disagree about what \"unavailable\" means.\n */\nexport function isDateAllowed(\n iso: string,\n min: string | undefined,\n max: string | undefined,\n excluded: (iso: string) => boolean,\n): boolean {\n return isWithin(iso, min, max) && !excluded(iso)\n}\n\n/** One square of a month grid. */\nexport interface MonthCell {\n /** The day it stands for, as an ISO `YYYY-MM-DD` string. */\n iso: string\n /** The day of the month, carried so a caller does not parse back what was just formatted. */\n day: number\n /**\n * Which side of the displayed month this day belongs to when it is not part of it,\n * and `null` when it is.\n */\n adjacent: 'prev' | 'next' | null\n}\n\n/**\n * Builds the grid of a month: 42 cells, six rows of seven, filled out at both ends\n * with the days of the neighbouring months. The count is fixed on purpose, so that\n * the calendar keeps the same height from one month to the next instead of jumping\n * by a row. `firstDayOfWeek` runs from 0 for Sunday to 6 for Saturday.\n */\nexport function buildMonthGrid(year: number, month0: number, firstDayOfWeek: number): MonthCell[] {\n const first = new Date(year, month0, 1)\n // How many cells the 1st of the month sits after the start of its row, which is\n // exactly how many days of the previous month the grid has to open with.\n const offset = (first.getDay() - firstDayOfWeek + 7) % 7\n const cells: MonthCell[] = []\n for (let i = 0; i < 42; i++) {\n // Built from the 1st rather than stepped from a start date, so the month and year\n // rolling over at either end is `Date`'s arithmetic and not ours.\n const d = new Date(year, month0, 1 - offset + i)\n const adjacent =\n d.getMonth() === month0 && d.getFullYear() === year ? null : d < first ? 'prev' : 'next'\n cells.push({ iso: formatISO(d), day: d.getDate(), adjacent })\n }\n return cells\n}\n\nconst firstDayCache = new Map<string, number>()\n\n// @fallback @ssr\n/**\n * The day the week starts on in a given locale, from 0 for Sunday to 6 for Saturday\n * — Sunday in the United States, Monday in most of Europe, Saturday in much of the\n * Middle East. It comes from `Intl.Locale`, whose own numbering runs from 1 for\n * Monday to 7 for Sunday.\n *\n * That part of `Intl` is not everywhere (some Node builds lack it), so the answer\n * falls back to Monday when it is missing. A component can always override the\n * result with its `firstDayOfWeek` prop.\n */\nexport function firstDayOfWeekFor(locale: string): number {\n return memo(firstDayCache, locale, () => resolveFirstDayOfWeek(locale))\n}\n\nfunction resolveFirstDayOfWeek(locale: string): number {\n try {\n // Implementations disagree on the shape: Chrome and Safari expose `weekInfo` as\n // a getter, others a `getWeekInfo()` method. Both are tried.\n const loc = new Intl.Locale(locale) as Intl.Locale & {\n weekInfo?: { firstDay: number }\n getWeekInfo?: () => { firstDay: number }\n }\n const info = loc.getWeekInfo?.() ?? loc.weekInfo\n if (info?.firstDay) return info.firstDay % 7 // brings Sunday, their 7, back to 0\n } catch {\n /* an invalid locale throws a RangeError: fall through to the fallback */\n }\n return 1 // Monday\n}\n\n// The reference instants the names are formatted from. Any Sunday will do for the\n// weekdays, and any year for the months; combined with `timeZone: 'UTC'` at every\n// call site, they pin the output whatever zone the machine is in.\nconst REF_SUNDAY = Date.UTC(2021, 7, 1) // 1 August 2021 fell on a Sunday\nconst MS_DAY = 86_400_000\n\n/**\n * The names of the seven days, starting from `firstDayOfWeek` so the list can be\n * dropped straight into a calendar header.\n */\nexport function weekdayNames(\n locale: string,\n firstDayOfWeek: number,\n weekday: 'short' | 'long' = 'short',\n): string[] {\n const fmt = new Intl.DateTimeFormat(locale, { weekday, timeZone: 'UTC' })\n return Array.from({ length: 7 }, (_, i) =>\n fmt.format(REF_SUNDAY + ((firstDayOfWeek + i) % 7) * MS_DAY),\n )\n}\n\n/** The full names of the twelve months, in January-to-December order. */\nexport function monthNames(locale: string): string[] {\n const fmt = new Intl.DateTimeFormat(locale, { month: 'long', timeZone: 'UTC' })\n return Array.from({ length: 12 }, (_, i) => fmt.format(Date.UTC(2021, i, 1)))\n}\n\n/**\n * Month names shortened for the picker's narrow cells: a name of four characters or\n * fewer is kept whole (\"May\", \"June\", \"July\"), a longer one is cut to three\n * characters followed by a dot (\"January\" becomes \"Jan.\"). The name is spread with\n * `[...n]` rather than indexed, so that an accented or non-Latin character counts as\n * one character and is never cut in half.\n */\nexport function monthNamesCompact(locale: string): string[] {\n return monthNames(locale).map((n) => {\n const chars = [...n]\n return chars.length <= 4 ? n : chars.slice(0, 3).join('') + '.'\n })\n}\n\n/**\n * One formatter kept per locale and set of options, for the lifetime of the module —\n * the same `formatterFor` idiom as in `utils/file.ts` and `utils/time.ts`.\n *\n * Building an `Intl.DateTimeFormat` costs one to two orders of magnitude more than\n * using one, and the three functions below are called ONE VALUE AT A TIME: VDateInput\n * formats a multiple selection inside a `.map`, so a fresh formatter would be built\n * for every date. `weekdayNames` and `monthNames` already hoist theirs out of their\n * loop; this cache gives the per-call functions the same property.\n *\n * The options object is part of the cache key. `JSON.stringify` is stable enough\n * here — these objects are literals written by the components, not data coming from\n * a user — and costs a fraction of a construction.\n */\nconst formatters = new Map<string, Intl.DateTimeFormat>()\n\nfunction formatterFor(locale: string, options: Intl.DateTimeFormatOptions): Intl.DateTimeFormat {\n return memo(\n formatters,\n `${locale}|${JSON.stringify(options)}`,\n () => new Intl.DateTimeFormat(locale, options),\n )\n}\n\n/** The full name of one month, 0 being January. */\nexport function monthName(locale: string, month0: number): string {\n return formatterFor(locale, { month: 'long', timeZone: 'UTC' }).format(Date.UTC(2021, month0, 1))\n}\n\n/**\n * A date written out for the reader, in the conventions of their locale — this is\n * what VDateInput shows in its field. An unparsable date yields an empty string\n * rather than a broken one.\n */\nexport function formatDateDisplay(\n iso: string,\n locale: string,\n options: Intl.DateTimeFormatOptions,\n): string {\n const d = parseISO(iso)\n return d ? formatterFor(locale, options).format(d) : ''\n}\n\n/**\n * A period written out for the reader. `Intl`'s own `formatRange` is what factors\n * out the parts the two dates share, giving \"19–26 June 2026\" rather than the two\n * full dates side by side. A period of a single day is formatted as that one date.\n */\nexport function formatDisplayRange(\n start: string,\n end: string,\n locale: string,\n options: Intl.DateTimeFormatOptions,\n): string {\n const a = parseISO(start)\n const b = parseISO(end)\n if (!a || !b) return ''\n const fmt = formatterFor(locale, options)\n return compareISO(start, end) === 0 ? fmt.format(a) : fmt.formatRange(a, b)\n}\n\n/*\n * The numeric input mask, used by VDateInput when its field can be typed into.\n *\n * A field being typed into never shows the long display format — \"10 June 2026\" is\n * not something one can type — but a purely numeric mask instead. The order of the\n * three fields and the separator between them are DERIVED from the locale rather\n * than hardcoded, which is what makes the same field work for a reader in Tokyo and\n * one in Chicago.\n */\n\nexport type DateMaskField = 'day' | 'month' | 'year'\n\n/** Everything a locale decides about how a date is typed. */\nexport interface DateMask {\n /**\n * The order the three fields appear in: day, month, year in the United Kingdom,\n * month, day, year in the United States, year, month, day in Japan.\n */\n order: readonly DateMaskField[]\n /** The single character between two fields, stripped of bidi marks and spaces. */\n separator: string\n /** How many digits each field takes, in the same order: 4 for the year, 2 otherwise. */\n lengths: readonly number[]\n /** How many digits the complete mask holds, which is always 8. */\n size: number\n}\n\nconst MASK_FALLBACK: DateMask = {\n order: ['day', 'month', 'year'],\n separator: '/',\n lengths: [2, 2, 4],\n size: 8,\n}\n\n/**\n * The date the mask is read from: 22 November 2021. Its three numbers all differ, so\n * whichever order the locale prints them in, each one can be told apart.\n */\nconst REF_MASK_DATE = Date.UTC(2021, 10, 22)\n\n/** The invisible direction marks some locales insert, such as U+200F before \"/\" in ar-EG. */\nconst BIDI_MARKS = /[]/g\n\nconst maskCache = new Map<string, DateMask>()\n\n/**\n * Works out how a date is typed in a given locale, by formatting a known date and\n * looking at what came out.\n *\n * The calendar and the numbering system are FORCED to Gregorian and Latin digits.\n * Without that, `fa-IR` answers with a Persian year (1400 rather than 2021) and\n * `ar-EG` with Arabic-Indic digits — two things a numeric field could neither\n * display nor read back. An invalid locale throws, and the answer then falls back to\n * day/month/year separated by \"/\".\n */\nexport function dateMaskFor(locale: string): DateMask {\n return memo(maskCache, locale, () => buildDateMask(locale))\n}\n\n/*\n * TRAP — the returned `DateMask` is SHARED between every caller for a locale, so it must be\n * treated as read-only. Nothing mutates it today (it is read field by field in\n * `formatDateMask`, `parseDateMask` and `maskPlaceholder`), and it is the same contract the\n * memoized `Intl` formatters in this file already have.\n */\nfunction buildDateMask(locale: string): DateMask {\n try {\n const parts = new Intl.DateTimeFormat(locale, {\n day: '2-digit',\n month: '2-digit',\n year: 'numeric',\n timeZone: 'UTC',\n calendar: 'gregory',\n numberingSystem: 'latn',\n }).formatToParts(REF_MASK_DATE)\n\n const order = parts\n .map((p) => p.type)\n .filter((t): t is DateMaskField => t === 'day' || t === 'month' || t === 'year')\n\n // The separator is the first literal appearing AFTER the first field, and not\n // simply the first literal: Hungarian and Korean end the whole format with a dot\n // (\"2021. 11. 22.\"), which must not be mistaken for it.\n const firstField = parts.findIndex((p) => p.type !== 'literal')\n const separator = parts\n .slice(firstField)\n .find((p) => p.type === 'literal')\n ?.value.replace(BIDI_MARKS, '')\n .trim()\n\n if (order.length === 3 && separator) {\n const lengths = order.map((f) => (f === 'year' ? 4 : 2))\n return { order, separator, lengths, size: 8 }\n }\n } catch {\n /* an invalid locale throws a RangeError: fall through to the fallback */\n }\n return MASK_FALLBACK\n}\n\n/**\n * Lays a run of digits out as masked text. The separator appears AS SOON AS the field\n * before it is full — typing \"22\" already gives \"22/\" — so the reader sees their\n * progress without ever having to type a separator themselves.\n *\n * This has a consequence the component must honour: pressing Backspace on such a\n * separator has to delete the DIGIT before it. Deleting the separator alone would\n * see the mask write it straight back, and the key would look dead.\n */\nexport function formatDateMask(digits: string, mask: DateMask): string {\n const all = digitsOf(digits).slice(0, mask.size)\n let out = ''\n let i = 0\n for (let f = 0; f < mask.lengths.length; f++) {\n const len = mask.lengths[f] as number\n const chunk = all.slice(i, i + len)\n if (!chunk) break\n out += chunk\n i += len\n if (chunk.length < len) break // this field is still being typed: no separator yet\n if (f < mask.lengths.length - 1) out += mask.separator\n }\n return out\n}\n\n/**\n * Writes an ISO date in the mask of the locale, ready to be put in the field: the\n * same day reads \"10/06/2026\" in London and \"06/10/2026\" in Chicago.\n */\nexport function isoToMask(iso: string, mask: DateMask): string {\n if (!isValidISO(iso)) return ''\n const [year, month, day] = iso.split('-') as [string, string, string]\n const by: Record<DateMaskField, string> = { year, month, day }\n return formatDateMask(mask.order.map((f) => by[f]).join(''), mask)\n}\n\nexport interface ParseMaskOptions {\n /**\n * The century a two-digit year is expanded into: with 2000, \"10/06/26\" is read as\n * 2026. It is only accepted when the year is the LAST field of the mask, since\n * elsewhere the following separator already tells the two apart.\n *\n * Leaving it out refuses any year shorter than four digits, and that is the mode\n * used while the reader types — so that \"26\", passed through on the way to \"2026\",\n * is never committed as a year of its own.\n */\n yearPivot?: number\n}\n\n/**\n * Reads masked text back into an ISO date, or returns `null` when the text is\n * incomplete, holds too many digits, or names a day that does not exist — 31\n * February passes every length check and is caught by the round trip `isValidISO`\n * performs.\n *\n * Whether the resulting date is allowed is a different question: the `min`/`max`\n * bounds and the disabled dates belong to the component, and this function knows\n * nothing about props.\n */\nexport function parseDateMask(\n text: string,\n mask: DateMask,\n options: ParseMaskOptions = {},\n): string | null {\n const digits = digitsOf(text)\n const by: Partial<Record<DateMaskField, string>> = {}\n let i = 0\n for (let k = 0; k < mask.order.length; k++) {\n const field = mask.order[k] as DateMaskField\n const len = mask.lengths[k] as number\n const chunk = digits.slice(i, i + len)\n if (chunk.length === len) i += len\n else if (\n field === 'year' &&\n options.yearPivot !== undefined &&\n k === mask.order.length - 1 &&\n chunk.length === 2\n )\n i += 2\n else return null\n by[field] = chunk\n }\n if (i !== digits.length) return null // digits are left over: the entry is too long\n const year =\n (by.year as string).length === 2\n ? String((options.yearPivot as number) + Number(by.year))\n : (by.year as string)\n const iso = `${year}-${by.month}-${by.day}`\n return isValidISO(iso) ? iso : null\n}\n\n/**\n * Where the caret has to go to sit just after the nth digit. Counting digits is the\n * only landmark that survives a reformat: an absolute position jumps by one the\n * moment a separator appears or disappears, so restoring it would leave the caret in\n * the wrong place on exactly the keystrokes that matter.\n *\n * When a separator is passed and it directly follows that position, the caret steps\n * over it: while typing, it must land in the NEXT field rather than in front of a\n * separator that has just been written. On deletion the argument is omitted, so the\n * caret stays before it and the next Backspace reaches the digit.\n */\nexport function caretAfterDigits(text: string, n: number, separator?: string): number {\n let pos = 0\n if (n > 0) {\n pos = text.length\n let seen = 0\n for (let i = 0; i < text.length; i++) {\n const code = text.charCodeAt(i)\n if (code >= 48 && code <= 57 && ++seen === n) {\n pos = i + 1\n break\n }\n }\n }\n if (separator && text.startsWith(separator, pos)) pos += separator.length\n return pos\n}\n\nconst PLACEHOLDER_FALLBACK: Record<DateMaskField, string> = { day: 'd', month: 'm', year: 'y' }\n\n/**\n * Ideographic scripts, which are excluded from the placeholder: a repeated \"日\" does\n * not read as a template the way a repeated letter does.\n */\nconst IDEOGRAPHIC = /[\\p{sc=Han}\\p{sc=Hangul}\\p{sc=Hiragana}\\p{sc=Katakana}]/u\n\n// @fallback\n/**\n * The empty template shown in the field: \"dd/mm/yyyy\" in English, \"jj/mm/aaaa\" in\n * French, \"tt.mm.jjjj\" in German, \"дд/мм/гггг\" in Russian.\n *\n * Each letter is the first letter of the field's own name in that language, taken\n * from `Intl.DisplayNames` — which lands on the attested convention of every\n * alphabetic script without a table to maintain. It falls back to the Latin letters\n * when that part of `Intl` is missing, or when the script is ideographic and the\n * repetition would mean nothing.\n */\nexport function maskPlaceholder(locale: string, mask: DateMask): string {\n const letters = placeholderLetters(locale)\n return mask.order.map((f, k) => letters[f].repeat(mask.lengths[k] as number)).join(mask.separator)\n}\n\nconst placeholderLetterCache = new Map<string, typeof PLACEHOLDER_FALLBACK>()\n\n/**\n * The three letters a locale writes its date fields with, worked out once per locale.\n *\n * The LETTERS are cached, not the finished placeholder: that also depends on the mask handed\n * in, and would be wrong the moment a caller passes one that is not `dateMaskFor(locale)`.\n * All the cost is here anyway — `Intl.DisplayNames` is this file's most expensive\n * constructor by an order of magnitude (~0.22 ms against ~0.07 for `dateMaskFor`).\n */\nfunction placeholderLetters(locale: string): typeof PLACEHOLDER_FALLBACK {\n return memo(placeholderLetterCache, locale, () => buildPlaceholderLetters(locale))\n}\n\nfunction buildPlaceholderLetters(locale: string): typeof PLACEHOLDER_FALLBACK {\n const letters = { ...PLACEHOLDER_FALLBACK }\n try {\n const names = new Intl.DisplayNames(locale, { type: 'dateTimeField' })\n for (const field of ['day', 'month', 'year'] as const) {\n const first = [...(names.of(field) ?? '')][0]\n if (first && /\\p{L}/u.test(first) && !IDEOGRAPHIC.test(first))\n letters[field] = first.toLocaleLowerCase(locale)\n }\n } catch {\n /* Intl.DisplayNames is unavailable here: keep the Latin letters */\n }\n return letters\n}\n"],"mappings":";;;AAiBA,IAAM,IAAS;AAOf,SAAgB,EAAW,GAA6B;CACtD,IAAI,OAAO,KAAQ,YAAY,CAAC,EAAO,KAAK,CAAG,GAAG,OAAO;CACzD,IAAM,IAAI,EAAS,CAAG;CACtB,OAAO,MAAM,QAAQ,EAAU,CAAC,MAAM;AACxC;AAOA,SAAgB,EAAS,GAA6C;CACpE,IAAI,OAAO,KAAQ,YAAY,CAAC,EAAO,KAAK,CAAG,GAAG,OAAO;CACzD,IAAM,IAAQ,EAAI,MAAM,GAAG,GACrB,IAAO,IAAI,KAAK,OAAO,EAAM,EAAE,GAAG,OAAO,EAAM,EAAE,IAAI,GAAG,OAAO,EAAM,EAAE,CAAC;CAC9E,OAAO,OAAO,MAAM,EAAK,QAAQ,CAAC,IAAI,OAAO;AAC/C;AAMA,SAAgB,EAAU,GAAoB;CAC5C,OAAO,GAAG,EAAK,YAAY,EAAE,GAAG,EAAK,EAAK,SAAS,IAAI,CAAC,EAAE,GAAG,EAAK,EAAK,QAAQ,CAAC;AAClF;AAMA,SAAgB,EAAM,GAAc,GAAgB,GAAqB;CACvE,OAAO,EAAU,IAAI,KAAK,GAAM,GAAQ,CAAG,CAAC;AAC9C;AAMA,SAAgB,EAAQ,GAAa,GAAmB;CACtD,IAAM,IAAI,EAAS,CAAG;CAGtB,OAFK,KACL,EAAE,QAAQ,EAAE,QAAQ,IAAI,CAAC,GAClB,EAAU,CAAC,KAFH;AAGjB;AAQA,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EAAwB,CAAM,CAAC;AACnF;AAEA,SAAS,EAAwB,GAA6C;CAC5E,IAAM,IAAU,EAAE,GAAG,EAAqB;CAC1C,IAAI;EACF,IAAM,IAAQ,IAAI,KAAK,aAAa,GAAQ,EAAE,MAAM,gBAAgB,CAAC;EACrE,KAAK,IAAM,KAAS;GAAC;GAAO;GAAS;EAAM,GAAY;GACrD,IAAM,IAAQ,CAAC,GAAI,EAAM,GAAG,CAAK,KAAK,EAAG,CAAC,CAAC;GAC3C,AAAI,KAAS,SAAS,KAAK,CAAK,KAAK,CAAC,EAAY,KAAK,CAAK,MAC1D,EAAQ,KAAS,EAAM,kBAAkB,CAAM;EACnD;CACF,QAAQ,CAER;CACA,OAAO;AACT"}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Whether an element is laid out right to left.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* reading them has to know which way the inline axis runs before it can decide what
|
|
8
|
-
* "forward" means.
|
|
4
|
+
* Logical properties mirror themselves, so this exists only for what cannot: key names
|
|
5
|
+
* (`ArrowRight`), pointer coordinates and scroll deltas are physical, and the code reading
|
|
6
|
+
* them has to know which way the inline axis runs before "forward" means anything.
|
|
9
7
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* or a loop.
|
|
14
|
-
*
|
|
15
|
-
* A null element answers `false`: a component whose ref is not set yet has nothing laid out,
|
|
16
|
-
* and left to right is the assumption the rest of the code already makes.
|
|
8
|
+
* The COMPUTED direction, not the `dir` attribute, which may sit on any ancestor or come
|
|
9
|
+
* from a stylesheet. That read forces a style recalculation — ask at event time, never in a
|
|
10
|
+
* render or a loop. A null element answers `false`, the assumption the rest of the code makes.
|
|
17
11
|
*/
|
|
18
12
|
export declare function isRtl(el: Element | null | undefined): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"direction.js","names":[],"sources":["../../src/utils/direction.ts"],"sourcesContent":["// @core\n/**\n * Whether an element is laid out right to left.\n *\n *
|
|
1
|
+
{"version":3,"file":"direction.js","names":[],"sources":["../../src/utils/direction.ts"],"sourcesContent":["// @core\n/**\n * Whether an element is laid out right to left.\n *\n * Logical properties mirror themselves, so this exists only for what cannot: key names\n * (`ArrowRight`), pointer coordinates and scroll deltas are physical, and the code reading\n * them has to know which way the inline axis runs before \"forward\" means anything.\n *\n * The COMPUTED direction, not the `dir` attribute, which may sit on any ancestor or come\n * from a stylesheet. That read forces a style recalculation — ask at event time, never in a\n * render or a loop. A null element answers `false`, the assumption the rest of the code makes.\n */\nexport function isRtl(el: Element | null | undefined): boolean {\n return el != null && getComputedStyle(el).direction === 'rtl'\n}\n"],"mappings":";AAYA,SAAgB,EAAM,GAAyC;CAC7D,OAAO,KAAM,QAAQ,iBAAiB,CAAE,CAAC,CAAC,cAAc;AAC1D"}
|
package/dist/utils/env.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Whether the library is running in a development build.
|
|
3
|
-
*
|
|
4
|
-
* each other — so that none of them reaches a finished application.
|
|
2
|
+
* Whether the library is running in a development build. Every integrator-facing warning
|
|
3
|
+
* is gated on it, so none reaches a finished application.
|
|
5
4
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* Looked up cautiously: the flag comes from the build tool the library is developed with,
|
|
6
|
+
* and an application built with another may not provide it — the warnings then stay silent
|
|
7
|
+
* rather than failing.
|
|
9
8
|
*/
|
|
10
9
|
export declare const isDev: boolean;
|