@vuetify/nightly 3.7.4-next.2024-11-06 → 3.7.5-master.2024-12-03
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/json/attributes.json +1561 -1561
- package/dist/json/importMap-labs.json +8 -8
- package/dist/json/importMap.json +120 -120
- package/dist/json/web-types.json +2945 -2945
- package/dist/vuetify-labs.css +25432 -23715
- package/dist/vuetify-labs.d.ts +14220 -3389
- package/dist/vuetify-labs.esm.js +73 -70
- package/dist/vuetify-labs.esm.js.map +1 -1
- package/dist/vuetify-labs.js +73 -70
- package/dist/vuetify-labs.min.css +4 -3
- package/dist/vuetify.css +23969 -22249
- package/dist/vuetify.d.ts +11832 -2652
- package/dist/vuetify.esm.js +62 -60
- package/dist/vuetify.esm.js.map +1 -1
- package/dist/vuetify.js +62 -60
- package/dist/vuetify.js.map +1 -1
- package/dist/vuetify.min.css +4 -3
- package/dist/vuetify.min.js +37 -37
- package/dist/vuetify.min.js.map +1 -1
- package/lib/components/VAlert/VAlert.css +215 -207
- package/lib/components/VAlert/VAlert.mjs +1 -1
- package/lib/components/VAlert/index.d.mts +86 -8
- package/lib/components/VApp/VApp.css +15 -16
- package/lib/components/VApp/index.d.mts +20 -4
- package/lib/components/VAppBar/VAppBar.css +12 -14
- package/lib/components/VAppBar/VAppBar.mjs +1 -1
- package/lib/components/VAppBar/VAppBarNavIcon.mjs +1 -1
- package/lib/components/VAppBar/VAppBarTitle.mjs +1 -1
- package/lib/components/VAppBar/index.d.mts +148 -12
- package/lib/components/VAutocomplete/VAutocomplete.css +85 -86
- package/lib/components/VAutocomplete/VAutocomplete.mjs +5 -5
- package/lib/components/VAutocomplete/VAutocomplete.mjs.map +1 -1
- package/lib/components/VAutocomplete/index.d.mts +1396 -237
- package/lib/components/VAvatar/VAvatar.css +106 -108
- package/lib/components/VAvatar/index.d.mts +31 -4
- package/lib/components/VBadge/VBadge.css +77 -73
- package/lib/components/VBadge/VBadge.mjs +1 -1
- package/lib/components/VBadge/VBadge.sass +4 -0
- package/lib/components/VBadge/index.d.mts +41 -4
- package/lib/components/VBanner/VBanner.css +166 -161
- package/lib/components/VBanner/VBanner.mjs +1 -1
- package/lib/components/VBanner/index.d.mts +88 -12
- package/lib/components/VBottomNavigation/VBottomNavigation.css +63 -64
- package/lib/components/VBottomNavigation/index.d.mts +32 -4
- package/lib/components/VBottomSheet/VBottomSheet.css +31 -34
- package/lib/components/VBottomSheet/VBottomSheet.mjs +1 -1
- package/lib/components/VBottomSheet/index.d.mts +88 -4
- package/lib/components/VBreadcrumbs/VBreadcrumbs.css +57 -54
- package/lib/components/VBreadcrumbs/VBreadcrumbs.mjs +1 -1
- package/lib/components/VBreadcrumbs/VBreadcrumbsItem.mjs +1 -1
- package/lib/components/VBreadcrumbs/index.d.mts +65 -12
- package/lib/components/VBtn/VBtn.css +408 -385
- package/lib/components/VBtn/VBtn.mjs +1 -1
- package/lib/components/VBtn/VBtn.sass +4 -4
- package/lib/components/VBtn/index.d.mts +72 -4
- package/lib/components/VBtnGroup/VBtnGroup.css +64 -63
- package/lib/components/VBtnGroup/VBtnGroup.mjs +1 -1
- package/lib/components/VBtnGroup/index.d.mts +28 -4
- package/lib/components/VBtnToggle/VBtnToggle.css +14 -16
- package/lib/components/VBtnToggle/VBtnToggle.mjs +1 -1
- package/lib/components/VBtnToggle/index.d.mts +24 -4
- package/lib/components/VCard/VCard.css +302 -294
- package/lib/components/VCard/VCard.mjs +1 -1
- package/lib/components/VCard/VCardItem.mjs +1 -1
- package/lib/components/VCard/VCardSubtitle.mjs +1 -1
- package/lib/components/VCard/VCardText.mjs +1 -1
- package/lib/components/VCard/index.d.mts +190 -24
- package/lib/components/VCarousel/VCarousel.css +65 -63
- package/lib/components/VCarousel/VCarousel.mjs +1 -1
- package/lib/components/VCarousel/VCarousel.sass +1 -1
- package/lib/components/VCarousel/VCarouselItem.mjs +1 -1
- package/lib/components/VCarousel/index.d.mts +86 -8
- package/lib/components/VCheckbox/VCheckbox.css +5 -7
- package/lib/components/VCheckbox/VCheckbox.mjs +1 -1
- package/lib/components/VCheckbox/VCheckboxBtn.mjs +1 -1
- package/lib/components/VCheckbox/index.d.mts +90 -8
- package/lib/components/VChip/VChip.css +411 -378
- package/lib/components/VChip/VChip.mjs +4 -3
- package/lib/components/VChip/VChip.mjs.map +1 -1
- package/lib/components/VChip/index.d.mts +113 -12
- package/lib/components/VChipGroup/VChipGroup.css +18 -19
- package/lib/components/VChipGroup/VChipGroup.mjs +1 -1
- package/lib/components/VChipGroup/index.d.mts +28 -4
- package/lib/components/VCode/VCode.css +8 -10
- package/lib/components/VCode/index.d.mts +18 -4
- package/lib/components/VColorPicker/VColorPicker.css +22 -22
- package/lib/components/VColorPicker/VColorPicker.mjs +1 -1
- package/lib/components/VColorPicker/VColorPickerCanvas.css +22 -24
- package/lib/components/VColorPicker/VColorPickerEdit.css +28 -29
- package/lib/components/VColorPicker/VColorPickerPreview.css +67 -69
- package/lib/components/VColorPicker/VColorPickerPreview.sass +2 -4
- package/lib/components/VColorPicker/VColorPickerSwatches.css +34 -34
- package/lib/components/VColorPicker/index.d.mts +68 -4
- package/lib/components/VCombobox/VCombobox.css +85 -86
- package/lib/components/VCombobox/VCombobox.mjs +5 -5
- package/lib/components/VCombobox/VCombobox.mjs.map +1 -1
- package/lib/components/VCombobox/index.d.mts +1396 -237
- package/lib/components/VConfirmEdit/VConfirmEdit.mjs +9 -7
- package/lib/components/VConfirmEdit/VConfirmEdit.mjs.map +1 -1
- package/lib/components/VConfirmEdit/__test__/VConfirmEdit.spec.browser.mjs +2 -2
- package/lib/components/VConfirmEdit/__test__/VConfirmEdit.spec.browser.mjs.map +1 -1
- package/lib/components/VConfirmEdit/index.d.mts +16 -13
- package/lib/components/VCounter/VCounter.css +5 -7
- package/lib/components/VCounter/VCounter.mjs +1 -1
- package/lib/components/VCounter/index.d.mts +31 -9
- package/lib/components/VDataIterator/index.d.mts +56 -12
- package/lib/components/VDataTable/VDataTable.css +186 -189
- package/lib/components/VDataTable/VDataTable.mjs +1 -1
- package/lib/components/VDataTable/VDataTable.sass +10 -20
- package/lib/components/VDataTable/VDataTableFooter.css +31 -33
- package/lib/components/VDataTable/VDataTableFooter.mjs +1 -1
- package/lib/components/VDataTable/VDataTableGroupHeaderRow.mjs +1 -1
- package/lib/components/VDataTable/VDataTableHeaders.mjs +1 -1
- package/lib/components/VDataTable/VDataTableRow.mjs +1 -1
- package/lib/components/VDataTable/VDataTableRows.mjs +1 -1
- package/lib/components/VDataTable/VDataTableServer.mjs +1 -1
- package/lib/components/VDataTable/VDataTableVirtual.mjs +1 -1
- package/lib/components/VDataTable/index.d.mts +388 -36
- package/lib/components/VDatePicker/VDatePicker.css +6 -8
- package/lib/components/VDatePicker/VDatePicker.mjs +1 -1
- package/lib/components/VDatePicker/VDatePickerControls.css +56 -54
- package/lib/components/VDatePicker/VDatePickerHeader.css +60 -56
- package/lib/components/VDatePicker/VDatePickerHeader.mjs +2 -1
- package/lib/components/VDatePicker/VDatePickerHeader.mjs.map +1 -1
- package/lib/components/VDatePicker/VDatePickerMonth.css +55 -51
- package/lib/components/VDatePicker/VDatePickerMonth.mjs +1 -1
- package/lib/components/VDatePicker/VDatePickerMonths.css +19 -20
- package/lib/components/VDatePicker/VDatePickerMonths.mjs +1 -1
- package/lib/components/VDatePicker/VDatePickerYears.css +15 -16
- package/lib/components/VDatePicker/VDatePickerYears.mjs +1 -1
- package/lib/components/VDatePicker/index.d.mts +281 -29
- package/lib/components/VDefaultsProvider/index.d.mts +20 -4
- package/lib/components/VDialog/VDialog.css +95 -95
- package/lib/components/VDialog/VDialog.mjs +1 -1
- package/lib/components/VDialog/__test__/VDialog.spec.cy.mjs +1 -1
- package/lib/components/VDialog/index.d.mts +389 -143
- package/lib/components/VDivider/VDivider.css +52 -52
- package/lib/components/VDivider/index.d.mts +24 -4
- package/lib/components/VEmptyState/VEmptyState.css +67 -62
- package/lib/components/VEmptyState/VEmptyState.mjs +1 -1
- package/lib/components/VEmptyState/index.d.mts +66 -4
- package/lib/components/VExpansionPanel/VExpansionPanel.css +209 -203
- package/lib/components/VExpansionPanel/VExpansionPanel.sass +25 -27
- package/lib/components/VExpansionPanel/VExpansionPanelText.mjs +1 -1
- package/lib/components/VExpansionPanel/VExpansionPanelTitle.mjs +1 -1
- package/lib/components/VExpansionPanel/index.d.mts +152 -16
- package/lib/components/VFab/VFab.css +69 -74
- package/lib/components/VFab/VFab.mjs +1 -1
- package/lib/components/VFab/VFab.sass +4 -5
- package/lib/components/VFab/index.d.mts +78 -9
- package/lib/components/VField/VField.css +579 -539
- package/lib/components/VField/VField.mjs +3 -2
- package/lib/components/VField/VField.mjs.map +1 -1
- package/lib/components/VField/VFieldLabel.mjs +1 -1
- package/lib/components/VField/index.d.mts +59 -11
- package/lib/components/VFileInput/VFileInput.css +29 -31
- package/lib/components/VFileInput/VFileInput.mjs +1 -1
- package/lib/components/VFileInput/index.d.mts +256 -71
- package/lib/components/VFooter/VFooter.css +36 -38
- package/lib/components/VFooter/VFooter.mjs +1 -1
- package/lib/components/VFooter/index.d.mts +29 -4
- package/lib/components/VForm/index.d.mts +175 -267
- package/lib/components/VGrid/VContainer.mjs +1 -1
- package/lib/components/VGrid/VGrid.css +592 -565
- package/lib/components/VGrid/index.d.mts +118 -16
- package/lib/components/VHover/index.d.mts +33 -4
- package/lib/components/VIcon/VIcon.css +52 -51
- package/lib/components/VIcon/index.d.mts +75 -17
- package/lib/components/VImg/VImg.css +51 -50
- package/lib/components/VImg/VImg.mjs +1 -1
- package/lib/components/VImg/index.d.mts +74 -19
- package/lib/components/VInfiniteScroll/VInfiniteScroll.css +37 -36
- package/lib/components/VInfiniteScroll/VInfiniteScroll.mjs +1 -1
- package/lib/components/VInfiniteScroll/index.d.mts +46 -4
- package/lib/components/VInput/VInput.css +142 -131
- package/lib/components/VInput/VInput.mjs +1 -1
- package/lib/components/VInput/index.d.mts +37 -4
- package/lib/components/VItemGroup/VItemGroup.css +5 -7
- package/lib/components/VItemGroup/index.d.mts +65 -8
- package/lib/components/VKbd/VKbd.css +11 -13
- package/lib/components/VKbd/index.d.mts +18 -4
- package/lib/components/VLabel/VLabel.css +15 -16
- package/lib/components/VLabel/index.d.mts +20 -4
- package/lib/components/VLayout/VLayout.css +8 -10
- package/lib/components/VLayout/VLayoutItem.css +7 -8
- package/lib/components/VLayout/index.d.mts +48 -8
- package/lib/components/VLazy/VLazy.mjs +1 -1
- package/lib/components/VLazy/index.d.mts +31 -4
- package/lib/components/VList/VList.css +108 -104
- package/lib/components/VList/VList.mjs +4 -3
- package/lib/components/VList/VList.mjs.map +1 -1
- package/lib/components/VList/VList.sass +1 -1
- package/lib/components/VList/VListChildren.mjs +1 -1
- package/lib/components/VList/VListGroup.mjs +1 -1
- package/lib/components/VList/VListItem.css +452 -440
- package/lib/components/VList/VListItem.mjs +4 -3
- package/lib/components/VList/VListItem.mjs.map +1 -1
- package/lib/components/VList/VListItem.sass +1 -2
- package/lib/components/VList/VListItemAction.mjs +1 -1
- package/lib/components/VList/VListItemMedia.mjs +1 -1
- package/lib/components/VList/VListItemSubtitle.mjs +1 -1
- package/lib/components/VList/index.d.mts +301 -58
- package/lib/components/VLocaleProvider/VLocaleProvider.css +2 -4
- package/lib/components/VLocaleProvider/index.d.mts +21 -4
- package/lib/components/VMain/VMain.css +30 -32
- package/lib/components/VMain/index.d.mts +25 -4
- package/lib/components/VMenu/VMenu.css +19 -21
- package/lib/components/VMenu/VMenu.mjs +1 -1
- package/lib/components/VMenu/index.d.mts +397 -155
- package/lib/components/VMessages/VMessages.css +15 -17
- package/lib/components/VMessages/index.d.mts +27 -4
- package/lib/components/VNavigationDrawer/VNavigationDrawer.css +108 -106
- package/lib/components/VNavigationDrawer/VNavigationDrawer.mjs +1 -1
- package/lib/components/VNavigationDrawer/index.d.mts +62 -7
- package/lib/components/VOtpInput/VOtpInput.css +58 -56
- package/lib/components/VOtpInput/VOtpInput.mjs +1 -1
- package/lib/components/VOtpInput/index.d.mts +52 -7
- package/lib/components/VOverlay/VOverlay.css +63 -60
- package/lib/components/VOverlay/VOverlay.mjs +1 -1
- package/lib/components/VOverlay/VOverlay.sass +13 -14
- package/lib/components/VOverlay/index.d.mts +101 -19
- package/lib/components/VPagination/VPagination.css +8 -10
- package/lib/components/VPagination/VPagination.mjs +1 -1
- package/lib/components/VPagination/index.d.mts +64 -4
- package/lib/components/VParallax/VParallax.css +6 -8
- package/lib/components/VParallax/VParallax.mjs +1 -1
- package/lib/components/VParallax/index.d.mts +27 -4
- package/lib/components/VProgressCircular/VProgressCircular.css +101 -95
- package/lib/components/VProgressCircular/index.d.mts +34 -4
- package/lib/components/VProgressLinear/VProgressLinear.css +222 -209
- package/lib/components/VProgressLinear/index.d.mts +54 -4
- package/lib/components/VRadio/VRadio.mjs +1 -1
- package/lib/components/VRadio/index.d.mts +68 -4
- package/lib/components/VRadioGroup/VRadioGroup.css +12 -14
- package/lib/components/VRadioGroup/VRadioGroup.mjs +1 -1
- package/lib/components/VRadioGroup/index.d.mts +48 -4
- package/lib/components/VRangeSlider/VRangeSlider.mjs +1 -1
- package/lib/components/VRangeSlider/index.d.mts +107 -4
- package/lib/components/VRating/VRating.css +53 -52
- package/lib/components/VRating/VRating.mjs +1 -1
- package/lib/components/VRating/index.d.mts +42 -4
- package/lib/components/VResponsive/VResponsive.css +26 -25
- package/lib/components/VResponsive/index.d.mts +29 -4
- package/lib/components/VSelect/VSelect.css +52 -54
- package/lib/components/VSelect/VSelect.mjs +4 -4
- package/lib/components/VSelect/VSelect.mjs.map +1 -1
- package/lib/components/VSelect/index.d.mts +1388 -236
- package/lib/components/VSelectionControl/VSelectionControl.css +102 -100
- package/lib/components/VSelectionControl/VSelectionControl.mjs +1 -1
- package/lib/components/VSelectionControl/index.d.mts +37 -10
- package/lib/components/VSelectionControlGroup/VSelectionControlGroup.css +8 -10
- package/lib/components/VSelectionControlGroup/index.d.mts +26 -4
- package/lib/components/VSheet/VSheet.css +36 -38
- package/lib/components/VSheet/VSheet.mjs +1 -1
- package/lib/components/VSheet/index.d.mts +32 -4
- package/lib/components/VSkeletonLoader/VSkeletonLoader.css +224 -225
- package/lib/components/VSkeletonLoader/VSkeletonLoader.mjs +1 -1
- package/lib/components/VSkeletonLoader/index.d.mts +28 -4
- package/lib/components/VSlideGroup/VSlideGroup.css +55 -53
- package/lib/components/VSlideGroup/index.d.mts +70 -14
- package/lib/components/VSlider/VSlider.css +57 -53
- package/lib/components/VSlider/VSlider.mjs +1 -1
- package/lib/components/VSlider/VSliderThumb.css +153 -142
- package/lib/components/VSlider/VSliderThumb.mjs +1 -1
- package/lib/components/VSlider/VSliderTrack.css +174 -155
- package/lib/components/VSlider/index.d.mts +106 -4
- package/lib/components/VSnackbar/VSnackbar.css +140 -140
- package/lib/components/VSnackbar/VSnackbar.mjs +1 -1
- package/lib/components/VSnackbar/index.d.mts +398 -152
- package/lib/components/VSparkline/VBarline.mjs +2 -1
- package/lib/components/VSparkline/VBarline.mjs.map +1 -1
- package/lib/components/VSparkline/VSparkline.mjs +1 -1
- package/lib/components/VSparkline/VTrendline.mjs +2 -1
- package/lib/components/VSparkline/VTrendline.mjs.map +1 -1
- package/lib/components/VSparkline/index.d.mts +49 -4
- package/lib/components/VSpeedDial/VSpeedDial.css +41 -43
- package/lib/components/VSpeedDial/VSpeedDial.mjs +1 -1
- package/lib/components/VSpeedDial/index.d.mts +85 -4
- package/lib/components/VStepper/VStepper.css +56 -55
- package/lib/components/VStepper/VStepper.mjs +6 -5
- package/lib/components/VStepper/VStepper.mjs.map +1 -1
- package/lib/components/VStepper/VStepperItem.css +115 -112
- package/lib/components/VStepper/VStepperItem.mjs +6 -5
- package/lib/components/VStepper/VStepperItem.mjs.map +1 -1
- package/lib/components/VStepper/VStepperWindow.mjs +1 -1
- package/lib/components/VStepper/VStepperWindowItem.mjs +1 -1
- package/lib/components/VStepper/index.d.mts +301 -69
- package/lib/components/VSwitch/VSwitch.css +139 -129
- package/lib/components/VSwitch/VSwitch.mjs +1 -1
- package/lib/components/VSwitch/index.d.mts +59 -4
- package/lib/components/VSystemBar/VSystemBar.css +43 -45
- package/lib/components/VSystemBar/VSystemBar.mjs +1 -1
- package/lib/components/VSystemBar/index.d.mts +28 -4
- package/lib/components/VTable/VTable.css +141 -140
- package/lib/components/VTable/VTable.sass +2 -4
- package/lib/components/VTable/index.d.mts +33 -4
- package/lib/components/VTabs/VTab.css +29 -30
- package/lib/components/VTabs/VTab.mjs +1 -1
- package/lib/components/VTabs/VTabs.css +65 -59
- package/lib/components/VTabs/VTabs.mjs +1 -1
- package/lib/components/VTabs/VTabsWindow.mjs +1 -1
- package/lib/components/VTabs/VTabsWindowItem.mjs +1 -1
- package/lib/components/VTabs/index.d.mts +394 -98
- package/lib/components/VTextField/VTextField.css +68 -65
- package/lib/components/VTextField/VTextField.mjs +1 -1
- package/lib/components/VTextField/index.d.mts +374 -152
- package/lib/components/VTextarea/VTextarea.css +39 -47
- package/lib/components/VTextarea/VTextarea.mjs +1 -1
- package/lib/components/VTextarea/VTextarea.sass +2 -4
- package/lib/components/VTextarea/index.d.mts +244 -71
- package/lib/components/VThemeProvider/VThemeProvider.css +3 -5
- package/lib/components/VThemeProvider/index.d.mts +20 -4
- package/lib/components/VTimeline/VTimeline.css +418 -379
- package/lib/components/VTimeline/VTimeline.mjs +1 -1
- package/lib/components/VTimeline/VTimelineDivider.mjs +1 -1
- package/lib/components/VTimeline/VTimelineItem.mjs +1 -1
- package/lib/components/VTimeline/index.d.mts +75 -8
- package/lib/components/VToolbar/VToolbar.css +143 -136
- package/lib/components/VToolbar/VToolbar.mjs +1 -1
- package/lib/components/VToolbar/index.d.mts +90 -12
- package/lib/components/VTooltip/VTooltip.css +21 -25
- package/lib/components/VTooltip/VTooltip.mjs +1 -1
- package/lib/components/VTooltip/VTooltip.sass +6 -8
- package/lib/components/VTooltip/index.d.mts +386 -147
- package/lib/components/VValidation/index.d.mts +24 -10
- package/lib/components/VVirtualScroll/VVirtualScroll.css +9 -11
- package/lib/components/VVirtualScroll/VVirtualScroll.mjs +1 -1
- package/lib/components/VVirtualScroll/VVirtualScrollItem.mjs +1 -1
- package/lib/components/VVirtualScroll/index.d.mts +15 -4
- package/lib/components/VWindow/VWindow.css +70 -73
- package/lib/components/VWindow/VWindow.mjs +1 -1
- package/lib/components/VWindow/VWindowItem.mjs +1 -1
- package/lib/components/VWindow/index.d.mts +47 -8
- package/lib/components/index.d.mts +11793 -2613
- package/lib/components/transitions/dialog-transition.mjs +2 -1
- package/lib/components/transitions/dialog-transition.mjs.map +1 -1
- package/lib/components/transitions/index.d.mts +309 -64
- package/lib/composables/form.mjs +7 -2
- package/lib/composables/form.mjs.map +1 -1
- package/lib/composables/icons.mjs +1 -1
- package/lib/composables/theme.mjs +4 -4
- package/lib/composables/theme.mjs.map +1 -1
- package/lib/composables/validation.mjs +10 -12
- package/lib/composables/validation.mjs.map +1 -1
- package/lib/composables/variant.mjs +1 -1
- package/lib/composables/virtual.mjs +1 -1
- package/lib/composables/virtual.mjs.map +1 -1
- package/lib/directives/ripple/VRipple.css +36 -38
- package/lib/entry-bundler.mjs +1 -1
- package/lib/entry-bundler.mjs.map +1 -1
- package/lib/framework.mjs +1 -1
- package/lib/framework.mjs.map +1 -1
- package/lib/index.d.mts +44 -44
- package/lib/labs/VCalendar/VCalendar.css +225 -219
- package/lib/labs/VCalendar/VCalendar.mjs +1 -1
- package/lib/labs/VCalendar/VCalendarDay.css +32 -33
- package/lib/labs/VCalendar/VCalendarDay.mjs +1 -1
- package/lib/labs/VCalendar/VCalendarHeader.css +13 -13
- package/lib/labs/VCalendar/VCalendarInterval.css +42 -43
- package/lib/labs/VCalendar/VCalendarIntervalEvent.css +5 -7
- package/lib/labs/VCalendar/VCalendarMonthDay.css +58 -61
- package/lib/labs/VCalendar/VCalendarMonthDay.sass +2 -3
- package/lib/labs/VCalendar/index.d.mts +211 -24
- package/lib/labs/VDateInput/VDateInput.mjs +2 -2
- package/lib/labs/VDateInput/VDateInput.mjs.map +1 -1
- package/lib/labs/VDateInput/index.d.mts +115 -4
- package/lib/labs/VNumberInput/VNumberInput.css +38 -40
- package/lib/labs/VNumberInput/VNumberInput.mjs +8 -6
- package/lib/labs/VNumberInput/VNumberInput.mjs.map +1 -1
- package/lib/labs/VNumberInput/index.d.mts +1267 -564
- package/lib/labs/VPicker/VPicker.css +57 -53
- package/lib/labs/VPicker/VPicker.mjs +1 -1
- package/lib/labs/VPicker/index.d.mts +63 -8
- package/lib/labs/VPullToRefresh/index.d.mts +35 -4
- package/lib/labs/VSnackbarQueue/VSnackbarQueue.mjs +1 -1
- package/lib/labs/VSnackbarQueue/index.d.mts +453 -156
- package/lib/labs/VStepperVertical/VStepperVertical.mjs +1 -1
- package/lib/labs/VStepperVertical/VStepperVerticalActions.mjs +1 -1
- package/lib/labs/VStepperVertical/VStepperVerticalItem.mjs +1 -1
- package/lib/labs/VStepperVertical/index.d.mts +271 -56
- package/lib/labs/VTimePicker/VTimePicker.css +7 -9
- package/lib/labs/VTimePicker/VTimePicker.mjs +1 -1
- package/lib/labs/VTimePicker/VTimePickerClock.css +129 -126
- package/lib/labs/VTimePicker/VTimePickerControls.css +103 -102
- package/lib/labs/VTimePicker/VTimePickerControls.mjs +1 -1
- package/lib/labs/VTimePicker/index.d.mts +122 -12
- package/lib/labs/VTreeview/VTreeview.mjs +1 -1
- package/lib/labs/VTreeview/VTreeviewChildren.mjs +1 -1
- package/lib/labs/VTreeview/VTreeviewGroup.mjs +1 -1
- package/lib/labs/VTreeview/VTreeviewItem.css +15 -17
- package/lib/labs/VTreeview/VTreeviewItem.mjs +4 -5
- package/lib/labs/VTreeview/VTreeviewItem.mjs.map +1 -1
- package/lib/labs/VTreeview/VTreeviewItem.sass +1 -2
- package/lib/labs/VTreeview/index.d.mts +225 -38
- package/lib/labs/components.d.mts +2940 -1043
- package/lib/locale/fr.mjs +1 -1
- package/lib/locale/fr.mjs.map +1 -1
- package/lib/styles/elements/_global.sass +1 -1
- package/lib/styles/generic/_colors.scss +3 -3
- package/lib/styles/generic/_layers.scss +1 -13
- package/lib/styles/generic/_transitions.scss +32 -32
- package/lib/styles/main.css +16139 -14666
- package/lib/styles/settings/_utilities.scss +5 -0
- package/lib/styles/settings/_variables.scss +2 -1
- package/lib/styles/tools/_bootable.sass +3 -0
- package/lib/styles/tools/_border.sass +4 -4
- package/lib/styles/tools/_display.sass +10 -0
- package/lib/styles/tools/_elevation.sass +2 -2
- package/lib/styles/tools/_index.sass +2 -0
- package/lib/styles/tools/_layer.scss +2 -4
- package/lib/styles/tools/_position.sass +2 -2
- package/lib/styles/tools/_radius.sass +10 -0
- package/lib/styles/tools/_rounded.sass +2 -2
- package/lib/styles/tools/_utilities.sass +5 -1
- package/lib/styles/utilities/_elevation.scss +1 -1
- package/package.json +4 -5
package/lib/composables/form.mjs
CHANGED
@@ -123,7 +123,12 @@ export function createForm(props) {
|
|
123
123
|
resetValidation
|
124
124
|
};
|
125
125
|
}
|
126
|
-
export function useForm() {
|
127
|
-
|
126
|
+
export function useForm(props) {
|
127
|
+
const form = inject(FormKey, null);
|
128
|
+
return {
|
129
|
+
...form,
|
130
|
+
isReadonly: computed(() => !!(props?.readonly ?? form?.isReadonly.value)),
|
131
|
+
isDisabled: computed(() => !!(props?.disabled ?? form?.isDisabled.value))
|
132
|
+
};
|
128
133
|
}
|
129
134
|
//# sourceMappingURL=form.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"form.mjs","names":["useProxiedModel","computed","inject","markRaw","provide","ref","shallowRef","toRef","watch","consoleWarn","propsFactory","FormKey","Symbol","for","makeFormProps","disabled","Boolean","fastFail","readonly","modelValue","type","default","validateOn","String","createForm","props","model","isDisabled","isReadonly","isValidating","items","errors","validate","results","valid","value","item","itemErrorMessages","length","push","id","errorMessages","reset","forEach","resetValidation","invalid","isValid","deep","flush","register","_ref","vm","some","unregister","filter","update","found","find","useForm"],"sources":["../../src/composables/form.ts"],"sourcesContent":["// Composables\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Utilities\nimport { computed, inject, markRaw, provide, ref, shallowRef, toRef, watch } from 'vue'\nimport { consoleWarn, propsFactory } from '@/util'\n\n// Types\nimport type { ComponentInternalInstance, ComputedRef, InjectionKey, PropType, Raw, Ref } from 'vue'\nimport type { ValidationProps } from './validation'\nimport type { EventProp } from '@/util'\n\nexport interface FormProvide {\n register: (item: {\n id: number | string\n vm: ComponentInternalInstance\n validate: () => Promise<string[]>\n reset: () => Promise<void>\n resetValidation: () => Promise<void>\n }) => void\n unregister: (id: number | string) => void\n update: (id: number | string, isValid: boolean | null, errorMessages: string[]) => void\n items: Ref<FormField[]>\n isDisabled: ComputedRef<boolean>\n isReadonly: ComputedRef<boolean>\n isValidating: Ref<boolean>\n isValid: Ref<boolean | null>\n validateOn: Ref<FormProps['validateOn']>\n}\n\nexport interface FormField {\n id: number | string\n validate: () => Promise<string[]>\n reset: () => Promise<void>\n resetValidation: () => Promise<void>\n vm: Raw<ComponentInternalInstance>\n isValid: boolean | null\n errorMessages: string[]\n}\n\nexport interface FieldValidationResult {\n id: number | string\n errorMessages: string[]\n}\n\nexport interface FormValidationResult {\n valid: boolean\n errors: FieldValidationResult[]\n}\n\nexport interface SubmitEventPromise extends SubmitEvent, Promise<FormValidationResult> {}\n\nexport const FormKey: InjectionKey<FormProvide> = Symbol.for('vuetify:form')\n\nexport interface FormProps {\n disabled: boolean\n fastFail: boolean\n readonly: boolean\n modelValue: boolean | null\n 'onUpdate:modelValue': EventProp<[boolean | null]> | undefined\n validateOn: ValidationProps['validateOn']\n}\n\nexport const makeFormProps = propsFactory({\n disabled: Boolean,\n fastFail: Boolean,\n readonly: Boolean,\n modelValue: {\n type: Boolean as PropType<boolean | null>,\n default: null,\n },\n validateOn: {\n type: String as PropType<FormProps['validateOn']>,\n default: 'input',\n },\n}, 'form')\n\nexport function createForm (props: FormProps) {\n const model = useProxiedModel(props, 'modelValue')\n\n const isDisabled = computed(() => props.disabled)\n const isReadonly = computed(() => props.readonly)\n const isValidating = shallowRef(false)\n const items = ref<FormField[]>([])\n const errors = ref<FieldValidationResult[]>([])\n\n async function validate () {\n const results = []\n let valid = true\n\n errors.value = []\n isValidating.value = true\n\n for (const item of items.value) {\n const itemErrorMessages = await item.validate()\n\n if (itemErrorMessages.length > 0) {\n valid = false\n\n results.push({\n id: item.id,\n errorMessages: itemErrorMessages,\n })\n }\n\n if (!valid && props.fastFail) break\n }\n\n errors.value = results\n isValidating.value = false\n\n return { valid, errors: errors.value }\n }\n\n function reset () {\n items.value.forEach(item => item.reset())\n }\n\n function resetValidation () {\n items.value.forEach(item => item.resetValidation())\n }\n\n watch(items, () => {\n let valid = 0\n let invalid = 0\n const results = []\n\n for (const item of items.value) {\n if (item.isValid === false) {\n invalid++\n results.push({\n id: item.id,\n errorMessages: item.errorMessages,\n })\n } else if (item.isValid === true) valid++\n }\n\n errors.value = results\n model.value =\n invalid > 0 ? false\n : valid === items.value.length ? true\n : null\n }, { deep: true, flush: 'post' })\n\n provide(FormKey, {\n register: ({ id, vm, validate, reset, resetValidation }) => {\n if (items.value.some(item => item.id === id)) {\n consoleWarn(`Duplicate input name \"${id}\"`)\n }\n\n items.value.push({\n id,\n validate,\n reset,\n resetValidation,\n vm: markRaw(vm),\n isValid: null,\n errorMessages: [],\n })\n },\n unregister: id => {\n items.value = items.value.filter(item => {\n return item.id !== id\n })\n },\n update: (id, isValid, errorMessages) => {\n const found = items.value.find(item => item.id === id)\n\n if (!found) return\n\n found.isValid = isValid\n found.errorMessages = errorMessages\n },\n isDisabled,\n isReadonly,\n isValidating,\n isValid: model,\n items,\n validateOn: toRef(props, 'validateOn'),\n })\n\n return {\n errors,\n isDisabled,\n isReadonly,\n isValidating,\n isValid: model,\n items,\n validate,\n reset,\n resetValidation,\n }\n}\n\nexport function useForm () {\n
|
1
|
+
{"version":3,"file":"form.mjs","names":["useProxiedModel","computed","inject","markRaw","provide","ref","shallowRef","toRef","watch","consoleWarn","propsFactory","FormKey","Symbol","for","makeFormProps","disabled","Boolean","fastFail","readonly","modelValue","type","default","validateOn","String","createForm","props","model","isDisabled","isReadonly","isValidating","items","errors","validate","results","valid","value","item","itemErrorMessages","length","push","id","errorMessages","reset","forEach","resetValidation","invalid","isValid","deep","flush","register","_ref","vm","some","unregister","filter","update","found","find","useForm","form"],"sources":["../../src/composables/form.ts"],"sourcesContent":["// Composables\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Utilities\nimport { computed, inject, markRaw, provide, ref, shallowRef, toRef, watch } from 'vue'\nimport { consoleWarn, propsFactory } from '@/util'\n\n// Types\nimport type { ComponentInternalInstance, ComputedRef, InjectionKey, PropType, Raw, Ref } from 'vue'\nimport type { ValidationProps } from './validation'\nimport type { EventProp } from '@/util'\n\nexport interface FormProvide {\n register: (item: {\n id: number | string\n vm: ComponentInternalInstance\n validate: () => Promise<string[]>\n reset: () => Promise<void>\n resetValidation: () => Promise<void>\n }) => void\n unregister: (id: number | string) => void\n update: (id: number | string, isValid: boolean | null, errorMessages: string[]) => void\n items: Ref<FormField[]>\n isDisabled: ComputedRef<boolean>\n isReadonly: ComputedRef<boolean>\n isValidating: Ref<boolean>\n isValid: Ref<boolean | null>\n validateOn: Ref<FormProps['validateOn']>\n}\n\nexport interface FormField {\n id: number | string\n validate: () => Promise<string[]>\n reset: () => Promise<void>\n resetValidation: () => Promise<void>\n vm: Raw<ComponentInternalInstance>\n isValid: boolean | null\n errorMessages: string[]\n}\n\nexport interface FieldValidationResult {\n id: number | string\n errorMessages: string[]\n}\n\nexport interface FormValidationResult {\n valid: boolean\n errors: FieldValidationResult[]\n}\n\nexport interface SubmitEventPromise extends SubmitEvent, Promise<FormValidationResult> {}\n\nexport const FormKey: InjectionKey<FormProvide> = Symbol.for('vuetify:form')\n\nexport interface FormProps {\n disabled: boolean\n fastFail: boolean\n readonly: boolean\n modelValue: boolean | null\n 'onUpdate:modelValue': EventProp<[boolean | null]> | undefined\n validateOn: ValidationProps['validateOn']\n}\n\nexport const makeFormProps = propsFactory({\n disabled: Boolean,\n fastFail: Boolean,\n readonly: Boolean,\n modelValue: {\n type: Boolean as PropType<boolean | null>,\n default: null,\n },\n validateOn: {\n type: String as PropType<FormProps['validateOn']>,\n default: 'input',\n },\n}, 'form')\n\nexport function createForm (props: FormProps) {\n const model = useProxiedModel(props, 'modelValue')\n\n const isDisabled = computed(() => props.disabled)\n const isReadonly = computed(() => props.readonly)\n const isValidating = shallowRef(false)\n const items = ref<FormField[]>([])\n const errors = ref<FieldValidationResult[]>([])\n\n async function validate () {\n const results = []\n let valid = true\n\n errors.value = []\n isValidating.value = true\n\n for (const item of items.value) {\n const itemErrorMessages = await item.validate()\n\n if (itemErrorMessages.length > 0) {\n valid = false\n\n results.push({\n id: item.id,\n errorMessages: itemErrorMessages,\n })\n }\n\n if (!valid && props.fastFail) break\n }\n\n errors.value = results\n isValidating.value = false\n\n return { valid, errors: errors.value }\n }\n\n function reset () {\n items.value.forEach(item => item.reset())\n }\n\n function resetValidation () {\n items.value.forEach(item => item.resetValidation())\n }\n\n watch(items, () => {\n let valid = 0\n let invalid = 0\n const results = []\n\n for (const item of items.value) {\n if (item.isValid === false) {\n invalid++\n results.push({\n id: item.id,\n errorMessages: item.errorMessages,\n })\n } else if (item.isValid === true) valid++\n }\n\n errors.value = results\n model.value =\n invalid > 0 ? false\n : valid === items.value.length ? true\n : null\n }, { deep: true, flush: 'post' })\n\n provide(FormKey, {\n register: ({ id, vm, validate, reset, resetValidation }) => {\n if (items.value.some(item => item.id === id)) {\n consoleWarn(`Duplicate input name \"${id}\"`)\n }\n\n items.value.push({\n id,\n validate,\n reset,\n resetValidation,\n vm: markRaw(vm),\n isValid: null,\n errorMessages: [],\n })\n },\n unregister: id => {\n items.value = items.value.filter(item => {\n return item.id !== id\n })\n },\n update: (id, isValid, errorMessages) => {\n const found = items.value.find(item => item.id === id)\n\n if (!found) return\n\n found.isValid = isValid\n found.errorMessages = errorMessages\n },\n isDisabled,\n isReadonly,\n isValidating,\n isValid: model,\n items,\n validateOn: toRef(props, 'validateOn'),\n })\n\n return {\n errors,\n isDisabled,\n isReadonly,\n isValidating,\n isValid: model,\n items,\n validate,\n reset,\n resetValidation,\n }\n}\n\nexport function useForm (props?: { readonly: boolean | null, disabled: boolean | null }) {\n const form = inject(FormKey, null)\n return {\n ...form,\n isReadonly: computed(() => !!(props?.readonly ?? form?.isReadonly.value)),\n isDisabled: computed(() => !!(props?.disabled ?? form?.isDisabled.value)),\n }\n}\n"],"mappings":"AAAA;AAAA,SACSA,eAAe,8BAExB;AACA,SAASC,QAAQ,EAAEC,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAEC,GAAG,EAAEC,UAAU,EAAEC,KAAK,EAAEC,KAAK,QAAQ,KAAK;AAAA,SAC9EC,WAAW,EAAEC,YAAY,6BAElC;AA6CA,OAAO,MAAMC,OAAkC,GAAGC,MAAM,CAACC,GAAG,CAAC,cAAc,CAAC;AAW5E,OAAO,MAAMC,aAAa,GAAGJ,YAAY,CAAC;EACxCK,QAAQ,EAAEC,OAAO;EACjBC,QAAQ,EAAED,OAAO;EACjBE,QAAQ,EAAEF,OAAO;EACjBG,UAAU,EAAE;IACVC,IAAI,EAAEJ,OAAmC;IACzCK,OAAO,EAAE;EACX,CAAC;EACDC,UAAU,EAAE;IACVF,IAAI,EAAEG,MAA2C;IACjDF,OAAO,EAAE;EACX;AACF,CAAC,EAAE,MAAM,CAAC;AAEV,OAAO,SAASG,UAAUA,CAAEC,KAAgB,EAAE;EAC5C,MAAMC,KAAK,GAAG1B,eAAe,CAACyB,KAAK,EAAE,YAAY,CAAC;EAElD,MAAME,UAAU,GAAG1B,QAAQ,CAAC,MAAMwB,KAAK,CAACV,QAAQ,CAAC;EACjD,MAAMa,UAAU,GAAG3B,QAAQ,CAAC,MAAMwB,KAAK,CAACP,QAAQ,CAAC;EACjD,MAAMW,YAAY,GAAGvB,UAAU,CAAC,KAAK,CAAC;EACtC,MAAMwB,KAAK,GAAGzB,GAAG,CAAc,EAAE,CAAC;EAClC,MAAM0B,MAAM,GAAG1B,GA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AEA,CAACf,EAAE,EAAEM,OAAO,EAAEL,aAAa,KAAK;MACtC,MAAMe,KAAK,GAAG1B,KAAK,CAACK,KAAK,CAACsB,IAAI,CAACrB,IAAI,IAAIA,IAAI,CAACI,EAAE,KAAKA,EAAE,CAAC;MAEtD,IAAI,CAACgB,KAAK,EAAE;MAEZA,KAAK,CAACV,OAAO,GAAGA,OAAO;MACvBU,KAAK,CAACf,aAAa,GAAGA,aAAa;IACrC,CAAC;IACDd,UAAU;IACVC,UAAU;IACVC,YAAY;IACZiB,OAAO,EAAEpB,KAAK;IACdI,KAAK;IACLR,UAAU,EAAEf,KAAK,CAACkB,KAAK,EAAE,YAAY;EACvC,CAAC,CAAC;EAEF,OAAO;IACLM,MAAM;IACNJ,UAAU;IACVC,UAAU;IACVC,YAAY;IACZiB,OAAO,EAAEpB,KAAK;IACdI,KAAK;IACLE,QAAQ;IACRU,KAAK;IACLE;EACF,CAAC;AACH;AAEA,OAAO,SAASc,OAAOA,CAAEjC,KAA8D,EAAE;EACvF,MAAMkC,IAAI,GAAGzD,MAAM,CAACS,OAAO,EAAE,IAAI,CAAC;EAClC,OAAO;IACL,GAAGgD,IAAI;IACP/B,UAAU,EAAE3B,QAAQ,CAAC,MAAM,CAAC,EAAEwB,KAAK,EAAEP,QAAQ,IAAIyC,IAAI,EAAE/B,UAAU,CAACO,KAAK,CAAC,CAAC;IACzER,UAAU,EAAE1B,QAAQ,CAAC,MAAM,CAAC,EAAEwB,KAAK,EAAEV,QAAQ,IAAI4C,IAAI,EAAEhC,UAAU,CAACQ,KAAK,CAAC;EAC1E,CAAC;AACH","ignoreList":[]}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { mergeProps as _mergeProps, createVNode as _createVNode } from "vue";
|
2
2
|
// Icons
|
3
3
|
import { aliases, mdi } from "../iconsets/mdi.mjs"; // Utilities
|
4
4
|
import { computed, inject, unref } from 'vue';
|
@@ -159,15 +159,15 @@ export function createTheme(options) {
|
|
159
159
|
const colors = new Set(Object.values(computedThemes.value).flatMap(theme => Object.keys(theme.colors)));
|
160
160
|
for (const key of colors) {
|
161
161
|
if (/^on-[a-z]/.test(key)) {
|
162
|
-
createCssClass(fgLines, `.${key}`, [`color: rgb(var(--v-theme-${key}))`]);
|
162
|
+
createCssClass(fgLines, `.${key}`, [`color: rgb(var(--v-theme-${key})) !important`]);
|
163
163
|
} else {
|
164
|
-
createCssClass(bgLines, `.bg-${key}`, [`--v-theme-overlay-multiplier: var(--v-theme-${key}-overlay-multiplier)`, `background-color: rgb(var(--v-theme-${key}))`, `color: rgb(var(--v-theme-on-${key}))`]);
|
165
|
-
createCssClass(fgLines, `.text-${key}`, [`color: rgb(var(--v-theme-${key}))`]);
|
164
|
+
createCssClass(bgLines, `.bg-${key}`, [`--v-theme-overlay-multiplier: var(--v-theme-${key}-overlay-multiplier)`, `background-color: rgb(var(--v-theme-${key})) !important`, `color: rgb(var(--v-theme-on-${key})) !important`]);
|
165
|
+
createCssClass(fgLines, `.text-${key}`, [`color: rgb(var(--v-theme-${key})) !important`]);
|
166
166
|
createCssClass(fgLines, `.border-${key}`, [`--v-border-color: var(--v-theme-${key})`]);
|
167
167
|
}
|
168
168
|
}
|
169
169
|
lines.push(...bgLines, ...fgLines);
|
170
|
-
return
|
170
|
+
return lines.map((str, i) => i === 0 ? str : ` ${str}`).join('');
|
171
171
|
});
|
172
172
|
function getHead() {
|
173
173
|
return {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"theme.mjs","names":["computed","inject","provide","ref","watch","watchEffect","createRange","darken","getCurrentInstance","getForeground","getLuma","IN_BROWSER","lighten","mergeDeep","parseColor","propsFactory","RGBtoHex","ThemeSymbol","Symbol","for","makeThemeProps","theme","String","genDefaults","defaultTheme","variations","colors","themes","light","dark","background","surface","primary","secondary","error","info","success","warning","variables","parseThemeOptions","options","arguments","length","undefined","defaults","isDisabled","key","Object","entries","createTheme","parsedOptions","name","computedThemes","acc","original","value","color","variation","fn","amount","keys","test","onColor","colorVal","current","styles","lines","createCssClass","genCssVariables","themeName","bgLines","fgLines","Set","values","flatMap","push","map","v","join","getHead","style","children","id","nonce","cspNonce","install","app","head","_context","provides","usehead","entry","patch","addHeadObjs","updateDOM","styleEl","document","getElementById","updateStyles","immediate","el","createElement","type","setAttribute","appendChild","innerHTML","themeClasses","global","provideTheme","props","Error","newTheme","useTheme","selector","content","line","lightOverlay","darkOverlay","rgb","r","g","b","startsWith"],"sources":["../../src/composables/theme.ts"],"sourcesContent":["// Utilities\nimport {\n computed,\n inject,\n provide,\n ref,\n watch,\n watchEffect,\n} from 'vue'\nimport {\n createRange,\n darken,\n getCurrentInstance,\n getForeground,\n getLuma,\n IN_BROWSER,\n lighten,\n mergeDeep,\n parseColor,\n propsFactory,\n RGBtoHex,\n} from '@/util'\n\n// Types\nimport type { VueHeadClient } from '@unhead/vue'\nimport type { HeadClient } from '@vueuse/head'\nimport type { App, DeepReadonly, InjectionKey, Ref } from 'vue'\n\ntype DeepPartial<T> = T extends object ? { [P in keyof T]?: DeepPartial<T[P]> } : T\n\nexport type ThemeOptions = false | {\n cspNonce?: string\n defaultTheme?: string\n variations?: false | VariationsOptions\n themes?: Record<string, ThemeDefinition>\n}\nexport type ThemeDefinition = DeepPartial<InternalThemeDefinition>\n\ninterface InternalThemeOptions {\n cspNonce?: string\n isDisabled: boolean\n defaultTheme: string\n variations: false | VariationsOptions\n themes: Record<string, InternalThemeDefinition>\n}\n\ninterface VariationsOptions {\n colors: string[]\n lighten: number\n darken: number\n}\n\ninterface InternalThemeDefinition {\n dark: boolean\n colors: Colors\n variables: Record<string, string | number>\n}\n\nexport interface Colors extends BaseColors, OnColors {\n [key: string]: string\n}\n\ninterface BaseColors {\n background: string\n surface: string\n primary: string\n secondary: string\n success: string\n warning: string\n error: string\n info: string\n}\n\ninterface OnColors {\n 'on-background': string\n 'on-surface': string\n 'on-primary': string\n 'on-secondary': string\n 'on-success': string\n 'on-warning': string\n 'on-error': string\n 'on-info': string\n}\n\nexport interface ThemeInstance {\n readonly isDisabled: boolean\n readonly themes: Ref<Record<string, InternalThemeDefinition>>\n\n readonly name: Readonly<Ref<string>>\n readonly current: DeepReadonly<Ref<InternalThemeDefinition>>\n readonly computedThemes: DeepReadonly<Ref<Record<string, InternalThemeDefinition>>>\n\n readonly themeClasses: Readonly<Ref<string | undefined>>\n readonly styles: Readonly<Ref<string>>\n\n readonly global: {\n readonly name: Ref<string>\n readonly current: DeepReadonly<Ref<InternalThemeDefinition>>\n }\n}\n\nexport const ThemeSymbol: InjectionKey<ThemeInstance> = Symbol.for('vuetify:theme')\n\nexport const makeThemeProps = propsFactory({\n theme: String,\n}, 'theme')\n\nfunction genDefaults () {\n return {\n defaultTheme: 'light',\n variations: { colors: [], lighten: 0, darken: 0 },\n themes: {\n light: {\n dark: false,\n colors: {\n background: '#FFFFFF',\n surface: '#FFFFFF',\n 'surface-bright': '#FFFFFF',\n 'surface-light': '#EEEEEE',\n 'surface-variant': '#424242',\n 'on-surface-variant': '#EEEEEE',\n primary: '#1867C0',\n 'primary-darken-1': '#1F5592',\n secondary: '#48A9A6',\n 'secondary-darken-1': '#018786',\n error: '#B00020',\n info: '#2196F3',\n success: '#4CAF50',\n warning: '#FB8C00',\n },\n variables: {\n 'border-color': '#000000',\n 'border-opacity': 0.12,\n 'high-emphasis-opacity': 0.87,\n 'medium-emphasis-opacity': 0.60,\n 'disabled-opacity': 0.38,\n 'idle-opacity': 0.04,\n 'hover-opacity': 0.04,\n 'focus-opacity': 0.12,\n 'selected-opacity': 0.08,\n 'activated-opacity': 0.12,\n 'pressed-opacity': 0.12,\n 'dragged-opacity': 0.08,\n 'theme-kbd': '#212529',\n 'theme-on-kbd': '#FFFFFF',\n 'theme-code': '#F5F5F5',\n 'theme-on-code': '#000000',\n },\n },\n dark: {\n dark: true,\n colors: {\n background: '#121212',\n surface: '#212121',\n 'surface-bright': '#ccbfd6',\n 'surface-light': '#424242',\n 'surface-variant': '#a3a3a3',\n 'on-surface-variant': '#424242',\n primary: '#2196F3',\n 'primary-darken-1': '#277CC1',\n secondary: '#54B6B2',\n 'secondary-darken-1': '#48A9A6',\n error: '#CF6679',\n info: '#2196F3',\n success: '#4CAF50',\n warning: '#FB8C00',\n },\n variables: {\n 'border-color': '#FFFFFF',\n 'border-opacity': 0.12,\n 'high-emphasis-opacity': 1,\n 'medium-emphasis-opacity': 0.70,\n 'disabled-opacity': 0.50,\n 'idle-opacity': 0.10,\n 'hover-opacity': 0.04,\n 'focus-opacity': 0.12,\n 'selected-opacity': 0.08,\n 'activated-opacity': 0.12,\n 'pressed-opacity': 0.16,\n 'dragged-opacity': 0.08,\n 'theme-kbd': '#212529',\n 'theme-on-kbd': '#FFFFFF',\n 'theme-code': '#343434',\n 'theme-on-code': '#CCCCCC',\n },\n },\n },\n }\n}\n\nfunction parseThemeOptions (options: ThemeOptions = genDefaults()): InternalThemeOptions {\n const defaults = genDefaults()\n\n if (!options) return { ...defaults, isDisabled: true } as any\n\n const themes: Record<string, InternalThemeDefinition> = {}\n for (const [key, theme] of Object.entries(options.themes ?? {})) {\n const defaultTheme = theme.dark || key === 'dark'\n ? defaults.themes?.dark\n : defaults.themes?.light\n themes[key] = mergeDeep(defaultTheme, theme) as InternalThemeDefinition\n }\n\n return mergeDeep(\n defaults,\n { ...options, themes },\n ) as InternalThemeOptions\n}\n\n// Composables\nexport function createTheme (options?: ThemeOptions): ThemeInstance & { install: (app: App) => void } {\n const parsedOptions = parseThemeOptions(options)\n const name = ref(parsedOptions.defaultTheme)\n const themes = ref(parsedOptions.themes)\n\n const computedThemes = computed(() => {\n const acc: Record<string, InternalThemeDefinition> = {}\n for (const [name, original] of Object.entries(themes.value)) {\n const theme: InternalThemeDefinition = acc[name] = {\n ...original,\n colors: {\n ...original.colors,\n },\n }\n\n if (parsedOptions.variations) {\n for (const name of parsedOptions.variations.colors) {\n const color = theme.colors[name]\n\n if (!color) continue\n\n for (const variation of (['lighten', 'darken'] as const)) {\n const fn = variation === 'lighten' ? lighten : darken\n for (const amount of createRange(parsedOptions.variations[variation], 1)) {\n theme.colors[`${name}-${variation}-${amount}`] = RGBtoHex(fn(parseColor(color), amount))\n }\n }\n }\n }\n\n for (const color of Object.keys(theme.colors)) {\n if (/^on-[a-z]/.test(color) || theme.colors[`on-${color}`]) continue\n\n const onColor = `on-${color}` as keyof OnColors\n const colorVal = parseColor(theme.colors[color]!)\n\n theme.colors[onColor] = getForeground(colorVal)\n }\n }\n\n return acc\n })\n const current = computed(() => computedThemes.value[name.value])\n\n const styles = computed(() => {\n const lines: string[] = []\n\n if (current.value?.dark) {\n createCssClass(lines, ':root', ['color-scheme: dark'])\n }\n\n createCssClass(lines, ':root', genCssVariables(current.value))\n\n for (const [themeName, theme] of Object.entries(computedThemes.value)) {\n createCssClass(lines, `.v-theme--${themeName}`, [\n `color-scheme: ${theme.dark ? 'dark' : 'normal'}`,\n ...genCssVariables(theme),\n ])\n }\n\n const bgLines: string[] = []\n const fgLines: string[] = []\n\n const colors = new Set(Object.values(computedThemes.value).flatMap(theme => Object.keys(theme.colors)))\n for (const key of colors) {\n if (/^on-[a-z]/.test(key)) {\n createCssClass(fgLines, `.${key}`, [`color: rgb(var(--v-theme-${key}))`])\n } else {\n createCssClass(bgLines, `.bg-${key}`, [\n `--v-theme-overlay-multiplier: var(--v-theme-${key}-overlay-multiplier)`,\n `background-color: rgb(var(--v-theme-${key}))`,\n `color: rgb(var(--v-theme-on-${key}))`,\n ])\n createCssClass(fgLines, `.text-${key}`, [`color: rgb(var(--v-theme-${key}))`])\n createCssClass(fgLines, `.border-${key}`, [`--v-border-color: var(--v-theme-${key})`])\n }\n }\n\n lines.push(...bgLines, ...fgLines)\n\n return '@layer vuetify.theme {\\n' + lines.map(v => ` ${v}`).join('') + '\\n}'\n })\n\n function getHead () {\n return {\n style: [{\n children: styles.value,\n id: 'vuetify-theme-stylesheet',\n nonce: parsedOptions.cspNonce || false as never,\n }],\n }\n }\n\n function install (app: App) {\n if (parsedOptions.isDisabled) return\n\n const head = app._context.provides.usehead as HeadClient & VueHeadClient<any> | undefined\n if (head) {\n if (head.push) {\n const entry = head.push(getHead)\n if (IN_BROWSER) {\n watch(styles, () => { entry.patch(getHead) })\n }\n } else {\n if (IN_BROWSER) {\n head.addHeadObjs(computed(getHead))\n watchEffect(() => head.updateDOM())\n } else {\n head.addHeadObjs(getHead())\n }\n }\n } else {\n let styleEl = IN_BROWSER\n ? document.getElementById('vuetify-theme-stylesheet')\n : null\n\n if (IN_BROWSER) {\n watch(styles, updateStyles, { immediate: true })\n } else {\n updateStyles()\n }\n\n function updateStyles () {\n if (typeof document !== 'undefined' && !styleEl) {\n const el = document.createElement('style')\n el.type = 'text/css'\n el.id = 'vuetify-theme-stylesheet'\n if (parsedOptions.cspNonce) el.setAttribute('nonce', parsedOptions.cspNonce)\n\n styleEl = el\n document.head.appendChild(styleEl)\n }\n\n if (styleEl) styleEl.innerHTML = styles.value\n }\n }\n }\n\n const themeClasses = computed(() => parsedOptions.isDisabled ? undefined : `v-theme--${name.value}`)\n\n return {\n install,\n isDisabled: parsedOptions.isDisabled,\n name,\n themes,\n current,\n computedThemes,\n themeClasses,\n styles,\n global: {\n name,\n current,\n },\n }\n}\n\nexport function provideTheme (props: { theme?: string }) {\n getCurrentInstance('provideTheme')\n\n const theme = inject(ThemeSymbol, null)\n\n if (!theme) throw new Error('Could not find Vuetify theme injection')\n\n const name = computed<string>(() => {\n return props.theme ?? theme.name.value\n })\n const current = computed(() => theme.themes.value[name.value])\n\n const themeClasses = computed(() => theme.isDisabled ? undefined : `v-theme--${name.value}`)\n\n const newTheme: ThemeInstance = {\n ...theme,\n name,\n current,\n themeClasses,\n }\n\n provide(ThemeSymbol, newTheme)\n\n return newTheme\n}\n\nexport function useTheme () {\n getCurrentInstance('useTheme')\n\n const theme = inject(ThemeSymbol, null)\n\n if (!theme) throw new Error('Could not find Vuetify theme injection')\n\n return theme\n}\n\nfunction createCssClass (lines: string[], selector: string, content: string[]) {\n lines.push(\n `${selector} {\\n`,\n ...content.map(line => ` ${line};\\n`),\n '}\\n',\n )\n}\n\nfunction genCssVariables (theme: InternalThemeDefinition) {\n const lightOverlay = theme.dark ? 2 : 1\n const darkOverlay = theme.dark ? 1 : 2\n\n const variables: string[] = []\n for (const [key, value] of Object.entries(theme.colors)) {\n const rgb = parseColor(value)\n variables.push(`--v-theme-${key}: ${rgb.r},${rgb.g},${rgb.b}`)\n if (!key.startsWith('on-')) {\n variables.push(`--v-theme-${key}-overlay-multiplier: ${getLuma(value) > 0.18 ? lightOverlay : darkOverlay}`)\n }\n }\n\n for (const [key, value] of Object.entries(theme.variables)) {\n const color = typeof value === 'string' && value.startsWith('#') ? parseColor(value) : undefined\n const rgb = color ? `${color.r}, ${color.g}, ${color.b}` : undefined\n variables.push(`--v-${key}: ${rgb ?? value}`)\n }\n\n return variables\n}\n"],"mappings":"AAAA;AACA,SACEA,QAAQ,EACRC,MAAM,EACNC,OAAO,EACPC,GAAG,EACHC,KAAK,EACLC,WAAW,QACN,KAAK;AAAA,SAEVC,WAAW,EACXC,MAAM,EACNC,kBAAkB,EAClBC,aAAa,EACbC,OAAO,EACPC,UAAU,EACVC,OAAO,EACPC,SAAS,EACTC,UAAU,EACVC,YAAY,EACZC,QAAQ,6BAGV;AA8EA,OAAO,MAAMC,WAAwC,GAAGC,MAAM,CAACC,GAAG,CAAC,eAAe,CAAC;AAEnF,OAAO,MAAMC,cAAc,GAAGL,YAAY,CAAC;EACzCM,KAAK,EAAEC;AACT,CAAC,EAAE,OAAO,CAAC;AAEX,SAASC,WAAWA,CAAA,EAAI;EACtB,OAAO;IACLC,YAAY,EAAE,OAAO;IACrBC,UAAU,EAAE;MAAEC,MAAM,EAAE,EAAE;MAAEd,OAAO,EAAE,CAAC;MAAEL,MAAM,EAAE;IAAE,CAAC;IACjDoB,MAAM,EAAE;MACNC,KAAK,EAAE;QACLC,IAAI,EAAE,KAAK;QACXH,MAAM,EAAE;UACNI,UAAU,EAAE,SAAS;UACrBC,OAAO,EAAE,SAAS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G6D,YAAY,GAAGC,WAAW,EAAE,CAAC;IAC9G;EACF;EAEA,KAAK,MAAM,CAACvE,GAAG,EAAES,KAAK,CAAC,IAAIR,MAAM,CAACC,OAAO,CAAC3B,KAAK,CAACiB,SAAS,CAAC,EAAE;IAC1D,MAAMkB,KAAK,GAAG,OAAOD,KAAK,KAAK,QAAQ,IAAIA,KAAK,CAACmE,UAAU,CAAC,GAAG,CAAC,GAAG5G,UAAU,CAACyC,KAAK,CAAC,GAAGZ,SAAS;IAChG,MAAM2E,GAAG,GAAG9D,KAAK,GAAG,GAAGA,KAAK,CAAC+D,CAAC,KAAK/D,KAAK,CAACgE,CAAC,KAAKhE,KAAK,CAACiE,CAAC,EAAE,GAAG9E,SAAS;IACpEL,SAAS,CAACqC,IAAI,CAAC,OAAO7B,GAAG,KAAKwE,GAAG,IAAI/D,KAAK,EAAE,CAAC;EAC/C;EAEA,OAAOjB,SAAS;AAClB","ignoreList":[]}
|
1
|
+
{"version":3,"file":"theme.mjs","names":["computed","inject","provide","ref","watch","watchEffect","createRange","darken","getCurrentInstance","getForeground","getLuma","IN_BROWSER","lighten","mergeDeep","parseColor","propsFactory","RGBtoHex","ThemeSymbol","Symbol","for","makeThemeProps","theme","String","genDefaults","defaultTheme","variations","colors","themes","light","dark","background","surface","primary","secondary","error","info","success","warning","variables","parseThemeOptions","options","arguments","length","undefined","defaults","isDisabled","key","Object","entries","createTheme","parsedOptions","name","computedThemes","acc","original","value","color","variation","fn","amount","keys","test","onColor","colorVal","current","styles","lines","createCssClass","genCssVariables","themeName","bgLines","fgLines","Set","values","flatMap","push","map","str","i","join","getHead","style","children","id","nonce","cspNonce","install","app","head","_context","provides","usehead","entry","patch","addHeadObjs","updateDOM","styleEl","document","getElementById","updateStyles","immediate","el","createElement","type","setAttribute","appendChild","innerHTML","themeClasses","global","provideTheme","props","Error","newTheme","useTheme","selector","content","line","lightOverlay","darkOverlay","rgb","r","g","b","startsWith"],"sources":["../../src/composables/theme.ts"],"sourcesContent":["// Utilities\nimport {\n computed,\n inject,\n provide,\n ref,\n watch,\n watchEffect,\n} from 'vue'\nimport {\n createRange,\n darken,\n getCurrentInstance,\n getForeground,\n getLuma,\n IN_BROWSER,\n lighten,\n mergeDeep,\n parseColor,\n propsFactory,\n RGBtoHex,\n} from '@/util'\n\n// Types\nimport type { VueHeadClient } from '@unhead/vue'\nimport type { HeadClient } from '@vueuse/head'\nimport type { App, DeepReadonly, InjectionKey, Ref } from 'vue'\n\ntype DeepPartial<T> = T extends object ? { [P in keyof T]?: DeepPartial<T[P]> } : T\n\nexport type ThemeOptions = false | {\n cspNonce?: string\n defaultTheme?: string\n variations?: false | VariationsOptions\n themes?: Record<string, ThemeDefinition>\n}\nexport type ThemeDefinition = DeepPartial<InternalThemeDefinition>\n\ninterface InternalThemeOptions {\n cspNonce?: string\n isDisabled: boolean\n defaultTheme: string\n variations: false | VariationsOptions\n themes: Record<string, InternalThemeDefinition>\n}\n\ninterface VariationsOptions {\n colors: string[]\n lighten: number\n darken: number\n}\n\ninterface InternalThemeDefinition {\n dark: boolean\n colors: Colors\n variables: Record<string, string | number>\n}\n\nexport interface Colors extends BaseColors, OnColors {\n [key: string]: string\n}\n\ninterface BaseColors {\n background: string\n surface: string\n primary: string\n secondary: string\n success: string\n warning: string\n error: string\n info: string\n}\n\ninterface OnColors {\n 'on-background': string\n 'on-surface': string\n 'on-primary': string\n 'on-secondary': string\n 'on-success': string\n 'on-warning': string\n 'on-error': string\n 'on-info': string\n}\n\nexport interface ThemeInstance {\n readonly isDisabled: boolean\n readonly themes: Ref<Record<string, InternalThemeDefinition>>\n\n readonly name: Readonly<Ref<string>>\n readonly current: DeepReadonly<Ref<InternalThemeDefinition>>\n readonly computedThemes: DeepReadonly<Ref<Record<string, InternalThemeDefinition>>>\n\n readonly themeClasses: Readonly<Ref<string | undefined>>\n readonly styles: Readonly<Ref<string>>\n\n readonly global: {\n readonly name: Ref<string>\n readonly current: DeepReadonly<Ref<InternalThemeDefinition>>\n }\n}\n\nexport const ThemeSymbol: InjectionKey<ThemeInstance> = Symbol.for('vuetify:theme')\n\nexport const makeThemeProps = propsFactory({\n theme: String,\n}, 'theme')\n\nfunction genDefaults () {\n return {\n defaultTheme: 'light',\n variations: { colors: [], lighten: 0, darken: 0 },\n themes: {\n light: {\n dark: false,\n colors: {\n background: '#FFFFFF',\n surface: '#FFFFFF',\n 'surface-bright': '#FFFFFF',\n 'surface-light': '#EEEEEE',\n 'surface-variant': '#424242',\n 'on-surface-variant': '#EEEEEE',\n primary: '#1867C0',\n 'primary-darken-1': '#1F5592',\n secondary: '#48A9A6',\n 'secondary-darken-1': '#018786',\n error: '#B00020',\n info: '#2196F3',\n success: '#4CAF50',\n warning: '#FB8C00',\n },\n variables: {\n 'border-color': '#000000',\n 'border-opacity': 0.12,\n 'high-emphasis-opacity': 0.87,\n 'medium-emphasis-opacity': 0.60,\n 'disabled-opacity': 0.38,\n 'idle-opacity': 0.04,\n 'hover-opacity': 0.04,\n 'focus-opacity': 0.12,\n 'selected-opacity': 0.08,\n 'activated-opacity': 0.12,\n 'pressed-opacity': 0.12,\n 'dragged-opacity': 0.08,\n 'theme-kbd': '#212529',\n 'theme-on-kbd': '#FFFFFF',\n 'theme-code': '#F5F5F5',\n 'theme-on-code': '#000000',\n },\n },\n dark: {\n dark: true,\n colors: {\n background: '#121212',\n surface: '#212121',\n 'surface-bright': '#ccbfd6',\n 'surface-light': '#424242',\n 'surface-variant': '#a3a3a3',\n 'on-surface-variant': '#424242',\n primary: '#2196F3',\n 'primary-darken-1': '#277CC1',\n secondary: '#54B6B2',\n 'secondary-darken-1': '#48A9A6',\n error: '#CF6679',\n info: '#2196F3',\n success: '#4CAF50',\n warning: '#FB8C00',\n },\n variables: {\n 'border-color': '#FFFFFF',\n 'border-opacity': 0.12,\n 'high-emphasis-opacity': 1,\n 'medium-emphasis-opacity': 0.70,\n 'disabled-opacity': 0.50,\n 'idle-opacity': 0.10,\n 'hover-opacity': 0.04,\n 'focus-opacity': 0.12,\n 'selected-opacity': 0.08,\n 'activated-opacity': 0.12,\n 'pressed-opacity': 0.16,\n 'dragged-opacity': 0.08,\n 'theme-kbd': '#212529',\n 'theme-on-kbd': '#FFFFFF',\n 'theme-code': '#343434',\n 'theme-on-code': '#CCCCCC',\n },\n },\n },\n }\n}\n\nfunction parseThemeOptions (options: ThemeOptions = genDefaults()): InternalThemeOptions {\n const defaults = genDefaults()\n\n if (!options) return { ...defaults, isDisabled: true } as any\n\n const themes: Record<string, InternalThemeDefinition> = {}\n for (const [key, theme] of Object.entries(options.themes ?? {})) {\n const defaultTheme = theme.dark || key === 'dark'\n ? defaults.themes?.dark\n : defaults.themes?.light\n themes[key] = mergeDeep(defaultTheme, theme) as InternalThemeDefinition\n }\n\n return mergeDeep(\n defaults,\n { ...options, themes },\n ) as InternalThemeOptions\n}\n\n// Composables\nexport function createTheme (options?: ThemeOptions): ThemeInstance & { install: (app: App) => void } {\n const parsedOptions = parseThemeOptions(options)\n const name = ref(parsedOptions.defaultTheme)\n const themes = ref(parsedOptions.themes)\n\n const computedThemes = computed(() => {\n const acc: Record<string, InternalThemeDefinition> = {}\n for (const [name, original] of Object.entries(themes.value)) {\n const theme: InternalThemeDefinition = acc[name] = {\n ...original,\n colors: {\n ...original.colors,\n },\n }\n\n if (parsedOptions.variations) {\n for (const name of parsedOptions.variations.colors) {\n const color = theme.colors[name]\n\n if (!color) continue\n\n for (const variation of (['lighten', 'darken'] as const)) {\n const fn = variation === 'lighten' ? lighten : darken\n for (const amount of createRange(parsedOptions.variations[variation], 1)) {\n theme.colors[`${name}-${variation}-${amount}`] = RGBtoHex(fn(parseColor(color), amount))\n }\n }\n }\n }\n\n for (const color of Object.keys(theme.colors)) {\n if (/^on-[a-z]/.test(color) || theme.colors[`on-${color}`]) continue\n\n const onColor = `on-${color}` as keyof OnColors\n const colorVal = parseColor(theme.colors[color]!)\n\n theme.colors[onColor] = getForeground(colorVal)\n }\n }\n\n return acc\n })\n const current = computed(() => computedThemes.value[name.value])\n\n const styles = computed(() => {\n const lines: string[] = []\n\n if (current.value?.dark) {\n createCssClass(lines, ':root', ['color-scheme: dark'])\n }\n\n createCssClass(lines, ':root', genCssVariables(current.value))\n\n for (const [themeName, theme] of Object.entries(computedThemes.value)) {\n createCssClass(lines, `.v-theme--${themeName}`, [\n `color-scheme: ${theme.dark ? 'dark' : 'normal'}`,\n ...genCssVariables(theme),\n ])\n }\n\n const bgLines: string[] = []\n const fgLines: string[] = []\n\n const colors = new Set(Object.values(computedThemes.value).flatMap(theme => Object.keys(theme.colors)))\n for (const key of colors) {\n if (/^on-[a-z]/.test(key)) {\n createCssClass(fgLines, `.${key}`, [`color: rgb(var(--v-theme-${key})) !important`])\n } else {\n createCssClass(bgLines, `.bg-${key}`, [\n `--v-theme-overlay-multiplier: var(--v-theme-${key}-overlay-multiplier)`,\n `background-color: rgb(var(--v-theme-${key})) !important`,\n `color: rgb(var(--v-theme-on-${key})) !important`,\n ])\n createCssClass(fgLines, `.text-${key}`, [`color: rgb(var(--v-theme-${key})) !important`])\n createCssClass(fgLines, `.border-${key}`, [`--v-border-color: var(--v-theme-${key})`])\n }\n }\n\n lines.push(...bgLines, ...fgLines)\n\n return lines.map((str, i) => i === 0 ? str : ` ${str}`).join('')\n })\n\n function getHead () {\n return {\n style: [{\n children: styles.value,\n id: 'vuetify-theme-stylesheet',\n nonce: parsedOptions.cspNonce || false as never,\n }],\n }\n }\n\n function install (app: App) {\n if (parsedOptions.isDisabled) return\n\n const head = app._context.provides.usehead as HeadClient & VueHeadClient<any> | undefined\n if (head) {\n if (head.push) {\n const entry = head.push(getHead)\n if (IN_BROWSER) {\n watch(styles, () => { entry.patch(getHead) })\n }\n } else {\n if (IN_BROWSER) {\n head.addHeadObjs(computed(getHead))\n watchEffect(() => head.updateDOM())\n } else {\n head.addHeadObjs(getHead())\n }\n }\n } else {\n let styleEl = IN_BROWSER\n ? document.getElementById('vuetify-theme-stylesheet')\n : null\n\n if (IN_BROWSER) {\n watch(styles, updateStyles, { immediate: true })\n } else {\n updateStyles()\n }\n\n function updateStyles () {\n if (typeof document !== 'undefined' && !styleEl) {\n const el = document.createElement('style')\n el.type = 'text/css'\n el.id = 'vuetify-theme-stylesheet'\n if (parsedOptions.cspNonce) el.setAttribute('nonce', parsedOptions.cspNonce)\n\n styleEl = el\n document.head.appendChild(styleEl)\n }\n\n if (styleEl) styleEl.innerHTML = styles.value\n }\n }\n }\n\n const themeClasses = computed(() => parsedOptions.isDisabled ? undefined : `v-theme--${name.value}`)\n\n return {\n install,\n isDisabled: parsedOptions.isDisabled,\n name,\n themes,\n current,\n computedThemes,\n themeClasses,\n styles,\n global: {\n name,\n current,\n },\n }\n}\n\nexport function provideTheme (props: { theme?: string }) {\n getCurrentInstance('provideTheme')\n\n const theme = inject(ThemeSymbol, null)\n\n if (!theme) throw new Error('Could not find Vuetify theme injection')\n\n const name = computed<string>(() => {\n return props.theme ?? theme.name.value\n })\n const current = computed(() => theme.themes.value[name.value])\n\n const themeClasses = computed(() => theme.isDisabled ? undefined : `v-theme--${name.value}`)\n\n const newTheme: ThemeInstance = {\n ...theme,\n name,\n current,\n themeClasses,\n }\n\n provide(ThemeSymbol, newTheme)\n\n return newTheme\n}\n\nexport function useTheme () {\n getCurrentInstance('useTheme')\n\n const theme = inject(ThemeSymbol, null)\n\n if (!theme) throw new Error('Could not find Vuetify theme injection')\n\n return theme\n}\n\nfunction createCssClass (lines: string[], selector: string, content: string[]) {\n lines.push(\n `${selector} {\\n`,\n ...content.map(line => ` ${line};\\n`),\n '}\\n',\n )\n}\n\nfunction genCssVariables (theme: InternalThemeDefinition) {\n const lightOverlay = theme.dark ? 2 : 1\n const darkOverlay = theme.dark ? 1 : 2\n\n const variables: string[] = []\n for (const [key, value] of Object.entries(theme.colors)) {\n const rgb = parseColor(value)\n variables.push(`--v-theme-${key}: ${rgb.r},${rgb.g},${rgb.b}`)\n if (!key.startsWith('on-')) {\n variables.push(`--v-theme-${key}-overlay-multiplier: ${getLuma(value) > 0.18 ? lightOverlay : darkOverlay}`)\n }\n }\n\n for (const [key, value] of Object.entries(theme.variables)) {\n const color = typeof value === 'string' && value.startsWith('#') ? parseColor(value) : undefined\n const rgb = color ? `${color.r}, ${color.g}, ${color.b}` : undefined\n variables.push(`--v-${key}: ${rgb ?? value}`)\n }\n\n return variables\n}\n"],"mappings":"AAAA;AACA,SACEA,QAAQ,EACRC,MAAM,EACNC,OAAO,EACPC,GAAG,EACHC,KAAK,EACLC,WAAW,QACN,KAAK;AAAA,SAEVC,WAAW,EACXC,MAAM,EACNC,kBAAkB,EAClBC,aAAa,EACbC,OAAO,EACPC,UAAU,EACVC,OAAO,EACPC,SAAS,EACTC,UAAU,EACVC,YAAY,EACZC,QAAQ,6BAGV;AA8EA,OAAO,MAAMC,WAAwC,GAAGC,MAAM,CAACC,GAAG,CAAC,eAAe,CAAC;AAEnF,OAAO,MAAMC,cAAc,GAAGL,YAAY,CAAC;EACzCM,KAAK,EAAEC;AACT,CAAC,EAAE,OAAO,CAAC;AAEX,SAASC,WAAWA,CAAA,EAAI;EACtB,OAAO;IACLC,YAAY,EAAE,OAAO;IACrBC,UAAU,EAAE;MAAEC,MAAM,EAAE,EAAE;MAAEd,OAAO,EAAE,CAAC;MAAEL,MAAM,EAAE;IAAE,CAAC;IACjDoB,MAAM,EAAE;MACNC,KAAK,EAAE;QACLC,IAAI,EAAE,KAAK;QACXH,MAAM,EAAE;UACNI,UAAU,EAAE,SAAS;UACrBC,OAAO,EAAE,SAAS;UAClB,gBAAgB,EAAE,SAAS;UAC3B,eAAe,EAAE,SAAS;UAC1B,iBAAiB,EAAE,SAAS;UAC5B,oBAAoB,EAAE,SAAS;UAC/BC,OAAO,EAAE,SAAS;UAClB,kBAAkB,EAAE,SAAS;UAC7BC,SAAS,EAAE,SAAS;UACpB,oBAAoB,EAAE,SAAS;UAC/BC,KAAK,EAAE,SAAS;UAChBC,IAAI,EAAE,SAAS;UACfC,OAAO,EAAE,SAAS;UAClBC,OAAO,EAAE;QACX,CA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,GAAGZ,SAAS;IAChG,MAAM4E,GAAG,GAAG/D,KAAK,GAAG,GAAGA,KAAK,CAACgE,CAAC,KAAKhE,KAAK,CAACiE,CAAC,KAAKjE,KAAK,CAACkE,CAAC,EAAE,GAAG/E,SAAS;IACpEL,SAAS,CAACqC,IAAI,CAAC,OAAO7B,GAAG,KAAKyE,GAAG,IAAIhE,KAAK,EAAE,CAAC;EAC/C;EAEA,OAAOjB,SAAS;AAClB","ignoreList":[]}
|
@@ -39,17 +39,15 @@ export function useValidation(props) {
|
|
39
39
|
let id = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : getUid();
|
40
40
|
const model = useProxiedModel(props, 'modelValue');
|
41
41
|
const validationModel = computed(() => props.validationValue === undefined ? model.value : props.validationValue);
|
42
|
-
const form = useForm();
|
42
|
+
const form = useForm(props);
|
43
43
|
const internalErrorMessages = ref([]);
|
44
44
|
const isPristine = shallowRef(true);
|
45
45
|
const isDirty = computed(() => !!(wrapInArray(model.value === '' ? null : model.value).length || wrapInArray(validationModel.value === '' ? null : validationModel.value).length));
|
46
|
-
const isDisabled = computed(() => !!(props.disabled ?? form?.isDisabled.value));
|
47
|
-
const isReadonly = computed(() => !!(props.readonly ?? form?.isReadonly.value));
|
48
46
|
const errorMessages = computed(() => {
|
49
47
|
return props.errorMessages?.length ? wrapInArray(props.errorMessages).concat(internalErrorMessages.value).slice(0, Math.max(0, +props.maxErrors)) : internalErrorMessages.value;
|
50
48
|
});
|
51
49
|
const validateOn = computed(() => {
|
52
|
-
let value = (props.validateOn ?? form?.
|
50
|
+
let value = (props.validateOn ?? form.validateOn?.value) || 'input';
|
53
51
|
if (value === 'lazy') value = 'input lazy';
|
54
52
|
if (value === 'eager') value = 'input eager';
|
55
53
|
const set = new Set(value?.split(' ') ?? []);
|
@@ -75,14 +73,14 @@ export function useValidation(props) {
|
|
75
73
|
return {
|
76
74
|
[`${name}--error`]: isValid.value === false,
|
77
75
|
[`${name}--dirty`]: isDirty.value,
|
78
|
-
[`${name}--disabled`]: isDisabled.value,
|
79
|
-
[`${name}--readonly`]: isReadonly.value
|
76
|
+
[`${name}--disabled`]: form.isDisabled.value,
|
77
|
+
[`${name}--readonly`]: form.isReadonly.value
|
80
78
|
};
|
81
79
|
});
|
82
80
|
const vm = getCurrentInstance('validation');
|
83
81
|
const uid = computed(() => props.name ?? unref(id));
|
84
82
|
onBeforeMount(() => {
|
85
|
-
form?.
|
83
|
+
form.register?.({
|
86
84
|
id: uid.value,
|
87
85
|
vm,
|
88
86
|
validate,
|
@@ -91,13 +89,13 @@ export function useValidation(props) {
|
|
91
89
|
});
|
92
90
|
});
|
93
91
|
onBeforeUnmount(() => {
|
94
|
-
form?.
|
92
|
+
form.unregister?.(uid.value);
|
95
93
|
});
|
96
94
|
onMounted(async () => {
|
97
95
|
if (!validateOn.value.lazy) {
|
98
96
|
await validate(!validateOn.value.eager);
|
99
97
|
}
|
100
|
-
form?.
|
98
|
+
form.update?.(uid.value, isValid.value, errorMessages.value);
|
101
99
|
});
|
102
100
|
useToggleScope(() => validateOn.value.input || validateOn.value.invalidInput && isValid.value === false, () => {
|
103
101
|
watch(validationModel, () => {
|
@@ -117,7 +115,7 @@ export function useValidation(props) {
|
|
117
115
|
});
|
118
116
|
});
|
119
117
|
watch([isValid, errorMessages], () => {
|
120
|
-
form?.
|
118
|
+
form.update?.(uid.value, isValid.value, errorMessages.value);
|
121
119
|
});
|
122
120
|
async function reset() {
|
123
121
|
model.value = null;
|
@@ -158,8 +156,8 @@ export function useValidation(props) {
|
|
158
156
|
return {
|
159
157
|
errorMessages,
|
160
158
|
isDirty,
|
161
|
-
isDisabled,
|
162
|
-
isReadonly,
|
159
|
+
isDisabled: form.isDisabled,
|
160
|
+
isReadonly: form.isReadonly,
|
163
161
|
isPristine,
|
164
162
|
isValid,
|
165
163
|
isValidating,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"validation.mjs","names":["makeFocusProps","useForm","useProxiedModel","useToggleScope","computed","nextTick","onBeforeMount","onBeforeUnmount","onMounted","ref","shallowRef","unref","watch","getCurrentInstance","getCurrentInstanceName","getUid","propsFactory","wrapInArray","makeValidationProps","disabled","type","Boolean","default","error","errorMessages","Array","String","maxErrors","Number","name","label","readonly","rules","modelValue","validateOn","validationValue","useValidation","props","arguments","length","undefined","id","model","validationModel","value","form","internalErrorMessages","isPristine","isDirty","isDisabled","isReadonly","concat","slice","Math","max","set","Set","split","input","has","blur","invalidInput","lazy","eager","isValid","isValidating","validationClasses","vm","uid","register","validate","reset","resetValidation","unregister","update","focused","unwatch","val","silent","results","rule","handler","result","console","warn","push"],"sources":["../../src/composables/validation.ts"],"sourcesContent":["// Composables\nimport { makeFocusProps } from '@/composables/focus'\nimport { useForm } from '@/composables/form'\nimport { useProxiedModel } from '@/composables/proxiedModel'\nimport { useToggleScope } from '@/composables/toggleScope'\n\n// Utilities\nimport { computed, nextTick, onBeforeMount, onBeforeUnmount, onMounted, ref, shallowRef, unref, watch } from 'vue'\nimport { getCurrentInstance, getCurrentInstanceName, getUid, propsFactory, wrapInArray } from '@/util'\n\n// Types\nimport type { PropType } from 'vue'\nimport type { EventProp, MaybeRef } from '@/util'\n\nexport type ValidationResult = string | boolean\nexport type ValidationRule =\n | ValidationResult\n | PromiseLike<ValidationResult>\n | ((value: any) => ValidationResult)\n | ((value: any) => PromiseLike<ValidationResult>)\n\ntype ValidateOnValue = 'blur' | 'input' | 'submit' | 'invalid-input'\ntype ValidateOn =\n | ValidateOnValue\n | `${ValidateOnValue} lazy`\n | `${ValidateOnValue} eager`\n | `lazy ${ValidateOnValue}`\n | `eager ${ValidateOnValue}`\n | 'lazy'\n | 'eager'\n\nexport interface ValidationProps {\n disabled: boolean | null\n error: boolean\n errorMessages: string | readonly string[] | null\n focused: boolean\n maxErrors: string | number\n name: string | undefined\n label: string | undefined\n readonly: boolean | null\n rules: readonly ValidationRule[]\n modelValue: any\n 'onUpdate:modelValue': EventProp | undefined\n validateOn?: ValidateOn\n validationValue: any\n}\n\nexport const makeValidationProps = propsFactory({\n disabled: {\n type: Boolean as PropType<boolean | null>,\n default: null,\n },\n error: Boolean,\n errorMessages: {\n type: [Array, String] as PropType<string | readonly string[] | null>,\n default: () => ([]),\n },\n maxErrors: {\n type: [Number, String],\n default: 1,\n },\n name: String,\n label: String,\n readonly: {\n type: Boolean as PropType<boolean | null>,\n default: null,\n },\n rules: {\n type: Array as PropType<readonly ValidationRule[]>,\n default: () => ([]),\n },\n modelValue: null,\n validateOn: String as PropType<ValidationProps['validateOn']>,\n validationValue: null,\n\n ...makeFocusProps(),\n}, 'validation')\n\nexport function useValidation (\n props: ValidationProps,\n name = getCurrentInstanceName(),\n id: MaybeRef<string | number> = getUid(),\n) {\n const model = useProxiedModel(props, 'modelValue')\n const validationModel = computed(() => props.validationValue === undefined ? model.value : props.validationValue)\n const form = useForm()\n const internalErrorMessages = ref<string[]>([])\n const isPristine = shallowRef(true)\n const isDirty = computed(() => !!(\n wrapInArray(model.value === '' ? null : model.value).length ||\n wrapInArray(validationModel.value === '' ? null : validationModel.value).length\n ))\n const isDisabled = computed(() => !!(props.disabled ?? form?.isDisabled.value))\n const isReadonly = computed(() => !!(props.readonly ?? form?.isReadonly.value))\n const errorMessages = computed(() => {\n return props.errorMessages?.length\n ? wrapInArray(props.errorMessages).concat(internalErrorMessages.value).slice(0, Math.max(0, +props.maxErrors))\n : internalErrorMessages.value\n })\n const validateOn = computed(() => {\n let value = (props.validateOn ?? form?.validateOn.value) || 'input'\n if (value === 'lazy') value = 'input lazy'\n if (value === 'eager') value = 'input eager'\n const set = new Set(value?.split(' ') ?? [])\n\n return {\n input: set.has('input'),\n blur: set.has('blur') || set.has('input') || set.has('invalid-input'),\n invalidInput: set.has('invalid-input'),\n lazy: set.has('lazy'),\n eager: set.has('eager'),\n }\n })\n const isValid = computed(() => {\n if (props.error || props.errorMessages?.length) return false\n if (!props.rules.length) return true\n if (isPristine.value) {\n return internalErrorMessages.value.length || validateOn.value.lazy ? null : true\n } else {\n return !internalErrorMessages.value.length\n }\n })\n const isValidating = shallowRef(false)\n const validationClasses = computed(() => {\n return {\n [`${name}--error`]: isValid.value === false,\n [`${name}--dirty`]: isDirty.value,\n [`${name}--disabled`]: isDisabled.value,\n [`${name}--readonly`]: isReadonly.value,\n }\n })\n\n const vm = getCurrentInstance('validation')\n const uid = computed(() => props.name ?? unref(id))\n\n onBeforeMount(() => {\n form?.register({\n id: uid.value,\n vm,\n validate,\n reset,\n resetValidation,\n })\n })\n\n onBeforeUnmount(() => {\n form?.unregister(uid.value)\n })\n\n onMounted(async () => {\n if (!validateOn.value.lazy) {\n await validate(!validateOn.value.eager)\n }\n form?.update(uid.value, isValid.value, errorMessages.value)\n })\n\n useToggleScope(() => validateOn.value.input || (validateOn.value.invalidInput && isValid.value === false), () => {\n watch(validationModel, () => {\n if (validationModel.value != null) {\n validate()\n } else if (props.focused) {\n const unwatch = watch(() => props.focused, val => {\n if (!val) validate()\n\n unwatch()\n })\n }\n })\n })\n\n useToggleScope(() => validateOn.value.blur, () => {\n watch(() => props.focused, val => {\n if (!val) validate()\n })\n })\n\n watch([isValid, errorMessages], () => {\n form?.update(uid.value, isValid.value, errorMessages.value)\n })\n\n async function reset () {\n model.value = null\n await nextTick()\n await resetValidation()\n }\n\n async function resetValidation () {\n isPristine.value = true\n if (!validateOn.value.lazy) {\n await validate(!validateOn.value.eager)\n } else {\n internalErrorMessages.value = []\n }\n }\n\n async function validate (silent = false) {\n const results = []\n\n isValidating.value = true\n\n for (const rule of props.rules) {\n if (results.length >= +(props.maxErrors ?? 1)) {\n break\n }\n\n const handler = typeof rule === 'function' ? rule : () => rule\n const result = await handler(validationModel.value)\n\n if (result === true) continue\n\n if (result !== false && typeof result !== 'string') {\n // eslint-disable-next-line no-console\n console.warn(`${result} is not a valid value. Rule functions must return boolean true or a string.`)\n\n continue\n }\n\n results.push(result || '')\n }\n\n internalErrorMessages.value = results\n isValidating.value = false\n isPristine.value = silent\n\n return internalErrorMessages.value\n }\n\n return {\n errorMessages,\n isDirty,\n isDisabled,\n isReadonly,\n isPristine,\n isValid,\n isValidating,\n reset,\n resetValidation,\n validate,\n validationClasses,\n }\n}\n"],"mappings":"AAAA;AAAA,SACSA,cAAc;AAAA,SACdC,OAAO;AAAA,SACPC,eAAe;AAAA,SACfC,cAAc,6BAEvB;AACA,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,aAAa,EAAEC,eAAe,EAAEC,SAAS,EAAEC,GAAG,EAAEC,UAAU,EAAEC,KAAK,EAAEC,KAAK,QAAQ,KAAK;AAAA,SACzGC,kBAAkB,EAAEC,sBAAsB,EAAEC,MAAM,EAAEC,YAAY,EAAEC,WAAW,6BAEtF;AAqCA,OAAO,MAAMC,mBAAmB,GAAGF,YAAY,CAAC;EAC9CG,QAAQ,EAAE;IACRC,IAAI,EAAEC,OAAmC;IACzCC,OAAO,EAAE;EACX,CAAC;EACDC,KAAK,EAAEF,OAAO;EACdG,aAAa,EAAE;IACbJ,IAAI,EAAE,CAACK,KAAK,EAAEC,MAAM,CAAgD;IACpEJ,OAAO,EAAEA,CAAA,KAAO;EAClB,CAAC;EACDK,SAAS,EAAE;IACTP,IAAI,EAAE,CAACQ,MAAM,EAAEF,MAAM,CAAC;IACtBJ,OAAO,EAAE;EACX,CAAC;EACDO,IAAI,EAAEH,MAAM;EACZI,KAAK,EAAEJ,MAAM;EACbK,QAAQ,EAAE;IACRX,IAAI,EAAEC,OAAmC;IACzCC,OAAO,EAAE;EACX,CAAC;EACDU,KAAK,EAAE;IACLZ,IAAI,EAAEK,KAA4C;IAClDH,OAAO,EAAEA,CAAA,KAAO;EAClB,CAAC;EACDW,UAAU,EAAE,IAAI;EAChBC,UAAU,EAAER,MAAiD;EAC7DS,eAAe,EAAE,IAAI;EAErB,GAAGnC,cAAc,CAAC;AACpB,CAAC,EAAE,YAAY,CAAC;AAEhB,OAAO,SAASoC,aAAaA,CAC3BC,KAAsB,EAGtB;EAAA,IAFAR,IAAI,GAAAS,SAAA,CAAAC,MAAA,QAAAD,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UAAU;IACViB,OAAO;IACPC,YAAY;IACZM,KAAK;IACLC,eAAe;IACfF,QAAQ;IACRJ;EACF,CAAC;AACH","ignoreList":[]}
|
1
|
+
{"version":3,"file":"validation.mjs","names":["makeFocusProps","useForm","useProxiedModel","useToggleScope","computed","nextTick","onBeforeMount","onBeforeUnmount","onMounted","ref","shallowRef","unref","watch","getCurrentInstance","getCurrentInstanceName","getUid","propsFactory","wrapInArray","makeValidationProps","disabled","type","Boolean","default","error","errorMessages","Array","String","maxErrors","Number","name","label","readonly","rules","modelValue","validateOn","validationValue","useValidation","props","arguments","length","undefined","id","model","validationModel","value","form","internalErrorMessages","isPristine","isDirty","concat","slice","Math","max","set","Set","split","input","has","blur","invalidInput","lazy","eager","isValid","isValidating","validationClasses","isDisabled","isReadonly","vm","uid","register","validate","reset","resetValidation","unregister","update","focused","unwatch","val","silent","results","rule","handler","result","console","warn","push"],"sources":["../../src/composables/validation.ts"],"sourcesContent":["// Composables\nimport { makeFocusProps } from '@/composables/focus'\nimport { useForm } from '@/composables/form'\nimport { useProxiedModel } from '@/composables/proxiedModel'\nimport { useToggleScope } from '@/composables/toggleScope'\n\n// Utilities\nimport { computed, nextTick, onBeforeMount, onBeforeUnmount, onMounted, ref, shallowRef, unref, watch } from 'vue'\nimport { getCurrentInstance, getCurrentInstanceName, getUid, propsFactory, wrapInArray } from '@/util'\n\n// Types\nimport type { PropType } from 'vue'\nimport type { EventProp, MaybeRef } from '@/util'\n\nexport type ValidationResult = string | boolean\nexport type ValidationRule =\n | ValidationResult\n | PromiseLike<ValidationResult>\n | ((value: any) => ValidationResult)\n | ((value: any) => PromiseLike<ValidationResult>)\n\ntype ValidateOnValue = 'blur' | 'input' | 'submit' | 'invalid-input'\ntype ValidateOn =\n | ValidateOnValue\n | `${ValidateOnValue} lazy`\n | `${ValidateOnValue} eager`\n | `lazy ${ValidateOnValue}`\n | `eager ${ValidateOnValue}`\n | 'lazy'\n | 'eager'\n\nexport interface ValidationProps {\n disabled: boolean | null\n error: boolean\n errorMessages: string | readonly string[] | null\n focused: boolean\n maxErrors: string | number\n name: string | undefined\n label: string | undefined\n readonly: boolean | null\n rules: readonly ValidationRule[]\n modelValue: any\n 'onUpdate:modelValue': EventProp | undefined\n validateOn?: ValidateOn\n validationValue: any\n}\n\nexport const makeValidationProps = propsFactory({\n disabled: {\n type: Boolean as PropType<boolean | null>,\n default: null,\n },\n error: Boolean,\n errorMessages: {\n type: [Array, String] as PropType<string | readonly string[] | null>,\n default: () => ([]),\n },\n maxErrors: {\n type: [Number, String],\n default: 1,\n },\n name: String,\n label: String,\n readonly: {\n type: Boolean as PropType<boolean | null>,\n default: null,\n },\n rules: {\n type: Array as PropType<readonly ValidationRule[]>,\n default: () => ([]),\n },\n modelValue: null,\n validateOn: String as PropType<ValidationProps['validateOn']>,\n validationValue: null,\n\n ...makeFocusProps(),\n}, 'validation')\n\nexport function useValidation (\n props: ValidationProps,\n name = getCurrentInstanceName(),\n id: MaybeRef<string | number> = getUid(),\n) {\n const model = useProxiedModel(props, 'modelValue')\n const validationModel = computed(() => props.validationValue === undefined ? model.value : props.validationValue)\n const form = useForm(props)\n const internalErrorMessages = ref<string[]>([])\n const isPristine = shallowRef(true)\n const isDirty = computed(() => !!(\n wrapInArray(model.value === '' ? null : model.value).length ||\n wrapInArray(validationModel.value === '' ? null : validationModel.value).length\n ))\n const errorMessages = computed(() => {\n return props.errorMessages?.length\n ? wrapInArray(props.errorMessages).concat(internalErrorMessages.value).slice(0, Math.max(0, +props.maxErrors))\n : internalErrorMessages.value\n })\n const validateOn = computed(() => {\n let value = (props.validateOn ?? form.validateOn?.value) || 'input'\n if (value === 'lazy') value = 'input lazy'\n if (value === 'eager') value = 'input eager'\n const set = new Set(value?.split(' ') ?? [])\n\n return {\n input: set.has('input'),\n blur: set.has('blur') || set.has('input') || set.has('invalid-input'),\n invalidInput: set.has('invalid-input'),\n lazy: set.has('lazy'),\n eager: set.has('eager'),\n }\n })\n const isValid = computed(() => {\n if (props.error || props.errorMessages?.length) return false\n if (!props.rules.length) return true\n if (isPristine.value) {\n return internalErrorMessages.value.length || validateOn.value.lazy ? null : true\n } else {\n return !internalErrorMessages.value.length\n }\n })\n const isValidating = shallowRef(false)\n const validationClasses = computed(() => {\n return {\n [`${name}--error`]: isValid.value === false,\n [`${name}--dirty`]: isDirty.value,\n [`${name}--disabled`]: form.isDisabled.value,\n [`${name}--readonly`]: form.isReadonly.value,\n }\n })\n\n const vm = getCurrentInstance('validation')\n const uid = computed(() => props.name ?? unref(id))\n\n onBeforeMount(() => {\n form.register?.({\n id: uid.value,\n vm,\n validate,\n reset,\n resetValidation,\n })\n })\n\n onBeforeUnmount(() => {\n form.unregister?.(uid.value)\n })\n\n onMounted(async () => {\n if (!validateOn.value.lazy) {\n await validate(!validateOn.value.eager)\n }\n form.update?.(uid.value, isValid.value, errorMessages.value)\n })\n\n useToggleScope(() => validateOn.value.input || (validateOn.value.invalidInput && isValid.value === false), () => {\n watch(validationModel, () => {\n if (validationModel.value != null) {\n validate()\n } else if (props.focused) {\n const unwatch = watch(() => props.focused, val => {\n if (!val) validate()\n\n unwatch()\n })\n }\n })\n })\n\n useToggleScope(() => validateOn.value.blur, () => {\n watch(() => props.focused, val => {\n if (!val) validate()\n })\n })\n\n watch([isValid, errorMessages], () => {\n form.update?.(uid.value, isValid.value, errorMessages.value)\n })\n\n async function reset () {\n model.value = null\n await nextTick()\n await resetValidation()\n }\n\n async function resetValidation () {\n isPristine.value = true\n if (!validateOn.value.lazy) {\n await validate(!validateOn.value.eager)\n } else {\n internalErrorMessages.value = []\n }\n }\n\n async function validate (silent = false) {\n const results = []\n\n isValidating.value = true\n\n for (const rule of props.rules) {\n if (results.length >= +(props.maxErrors ?? 1)) {\n break\n }\n\n const handler = typeof rule === 'function' ? rule : () => rule\n const result = await handler(validationModel.value)\n\n if (result === true) continue\n\n if (result !== false && typeof result !== 'string') {\n // eslint-disable-next-line no-console\n console.warn(`${result} is not a valid value. Rule functions must return boolean true or a string.`)\n\n continue\n }\n\n results.push(result || '')\n }\n\n internalErrorMessages.value = results\n isValidating.value = false\n isPristine.value = silent\n\n return internalErrorMessages.value\n }\n\n return {\n errorMessages,\n isDirty,\n isDisabled: form.isDisabled,\n isReadonly: form.isReadonly,\n isPristine,\n isValid,\n isValidating,\n reset,\n resetValidation,\n validate,\n validationClasses,\n }\n}\n"],"mappings":"AAAA;AAAA,SACSA,cAAc;AAAA,SACdC,OAAO;AAAA,SACPC,eAAe;AAAA,SACfC,cAAc,6BAEvB;AACA,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,aAAa,EAAEC,eAAe,EAAEC,SAAS,EAAEC,GAAG,EAAEC,UAAU,EAAEC,KAAK,EAAEC,KAAK,QAAQ,KAAK;AAAA,SACzGC,kBAAkB,EAAEC,sBAAsB,EAAEC,MAAM,EAAEC,YAAY,EAAEC,WAAW,6BAEtF;AAqCA,OAAO,MAAMC,mBAAmB,GAAGF,YAAY,CAAC;EAC9CG,QAAQ,EAAE;IACRC,IAAI,EAAEC,OAAmC;IACzCC,OAAO,EAAE;EACX,CAAC;EACDC,KAAK,EAAEF,OAAO;EACdG,aAAa,EAAE;IACbJ,IAAI,EAAE,CAACK,KAAK,EAAEC,MAAM,CAAgD;IACpEJ,OAAO,EAAEA,CAAA,KAAO;EAClB,CAAC;EACDK,SAAS,EAAE;IACTP,IAAI,EAAE,CAACQ,MAAM,EAAEF,MAAM,CAAC;IACtBJ,OAAO,EAAE;EACX,CAAC;EACDO,IAAI,EAAEH,MAAM;EACZI,KAAK,EAAEJ,MAAM;EACbK,QAAQ,EAAE;IACRX,IAAI,EAAEC,OAAmC;IACzCC,OAAO,EAAE;EACX,CAAC;EACDU,KAAK,EAAE;IACLZ,IAAI,EAAEK,KAA4C;IAClDH,OAAO,EAAEA,CAAA,KAAO;EAClB,CAAC;EACDW,UAAU,EAAE,IAAI;EAChBC,UAAU,EAAER,MAAiD;EAC7DS,eAAe,EAAE,IAAI;EAErB,GAAGnC,cAAc,CAAC;AACp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C,eAAe;IACfF,QAAQ;IACRN;EACF,CAAC;AACH","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"virtual.mjs","names":["useDisplay","useResizeObserver","computed","nextTick","onScopeDispose","ref","shallowRef","watch","watchEffect","clamp","debounce","IN_BROWSER","propsFactory","UP","DOWN","BUFFER_PX","makeVirtualProps","itemHeight","type","Number","String","default","height","useVirtual","props","items","display","value","parseFloat","first","last","Math","ceil","parseInt","paddingTop","paddingBottom","containerRef","markerRef","markerOffset","resizeRef","contentRect","viewportHeight","document","documentElement","hasInitialRender","sizes","Array","from","length","offsets","updateTime","targetScrollIndex","getSize","index","updateOffsets","start","performance","now","i","max","unwatch","v","offsetTop","immediate","calculateVisibleItems","window","requestAnimationFrame","scrollToIndex","clear","handleItemResize","prevHeight","prevMinHeight","min","calculateOffset","calculateIndex","scrollTop","binaryClosest","lastScrollTop","scrollVelocity","lastScrollTime","val","oldVal","handleScroll","scrollTime","scrollDeltaT","sign","handleScrollend","raf","cancelAnimationFrame","_calculateVisibleItems","direction","startPx","endPx","end","topOverflow","bottomOverflow","bufferOverflow","offset","computedItems","slice","map","item","raw","deep","arr","high","low","mid","target"],"sources":["../../src/composables/virtual.ts"],"sourcesContent":["// Composables\nimport { useDisplay } from '@/composables/display'\nimport { useResizeObserver } from '@/composables/resizeObserver'\n\n// Utilities\nimport { computed, nextTick, onScopeDispose, ref, shallowRef, watch, watchEffect } from 'vue'\nimport { clamp, debounce, IN_BROWSER, propsFactory } from '@/util'\n\n// Types\nimport type { Ref } from 'vue'\n\nconst UP = -1\nconst DOWN = 1\n\n/** Determines how large each batch of items should be */\nconst BUFFER_PX = 100\n\ntype VirtualProps = {\n itemHeight?: number | string\n height?: number | string\n}\n\nexport const makeVirtualProps = propsFactory({\n itemHeight: {\n type: [Number, String],\n default: null,\n },\n height: [Number, String],\n}, 'virtual')\n\nexport function useVirtual <T> (props: VirtualProps, items: Ref<readonly T[]>) {\n const display = useDisplay()\n\n const itemHeight = shallowRef(0)\n watchEffect(() => {\n itemHeight.value = parseFloat(props.itemHeight || 0)\n })\n\n const first = shallowRef(0)\n const last = shallowRef(Math.ceil(\n // Assume 16px items filling the entire screen height if\n // not provided. This is probably incorrect but it minimises\n // the chance of ending up with empty space at the bottom.\n // The default value is set here to avoid poisoning getSize()\n (parseInt(props.height!) || display.height.value) / (itemHeight.value || 16)\n ) || 1)\n const paddingTop = shallowRef(0)\n const paddingBottom = shallowRef(0)\n\n /** The scrollable element */\n const containerRef = ref<HTMLElement>()\n /** An element marking the top of the scrollable area,\n * used to add an offset if there's padding or other elements above the virtual list */\n const markerRef = ref<HTMLElement>()\n /** markerRef's offsetTop, lazily evaluated */\n let markerOffset = 0\n\n const { resizeRef, contentRect } = useResizeObserver()\n watchEffect(() => {\n resizeRef.value = containerRef.value\n })\n const viewportHeight = computed(() => {\n return containerRef.value === document.documentElement\n ? display.height.value\n : contentRect.value?.height || parseInt(props.height!) || 0\n })\n /** All static elements have been rendered and we have an assumed item height */\n const hasInitialRender = computed(() => {\n return !!(containerRef.value && markerRef.value && viewportHeight.value && itemHeight.value)\n })\n\n let sizes = Array.from<number | null>({ length: items.value.length })\n let offsets = Array.from<number>({ length: items.value.length })\n const updateTime = shallowRef(0)\n let targetScrollIndex = -1\n\n function getSize (index: number) {\n return sizes[index] || itemHeight.value\n }\n\n const updateOffsets = debounce(() => {\n const start = performance.now()\n offsets[0] = 0\n const length = items.value.length\n for (let i = 1; i <= length - 1; i++) {\n offsets[i] = (offsets[i - 1] || 0) + getSize(i - 1)\n }\n updateTime.value = Math.max(updateTime.value, performance.now() - start)\n }, updateTime)\n\n const unwatch = watch(hasInitialRender, v => {\n if (!v) return\n // First render is complete, update offsets and visible\n // items in case our assumed item height was incorrect\n\n unwatch()\n markerOffset = markerRef.value!.offsetTop\n updateOffsets.immediate()\n calculateVisibleItems()\n\n if (!~targetScrollIndex) return\n\n nextTick(() => {\n IN_BROWSER && window.requestAnimationFrame(() => {\n scrollToIndex(targetScrollIndex)\n targetScrollIndex = -1\n })\n })\n })\n\n onScopeDispose(() => {\n updateOffsets.clear()\n })\n\n function handleItemResize (index: number, height: number) {\n const prevHeight = sizes[index]\n const prevMinHeight = itemHeight.value\n\n itemHeight.value = prevMinHeight ? Math.min(itemHeight.value, height) : height\n\n if (prevHeight !== height || prevMinHeight !== itemHeight.value) {\n sizes[index] = height\n updateOffsets()\n }\n }\n\n function calculateOffset (index: number) {\n index = clamp(index, 0, items.value.length - 1)\n return offsets[index] || 0\n }\n\n function calculateIndex (scrollTop: number) {\n return binaryClosest(offsets, scrollTop)\n }\n\n let lastScrollTop = 0\n let scrollVelocity = 0\n let lastScrollTime = 0\n\n watch(viewportHeight, (val, oldVal) => {\n if (oldVal) {\n calculateVisibleItems()\n if (val < oldVal) {\n requestAnimationFrame(() => {\n scrollVelocity = 0\n calculateVisibleItems()\n })\n }\n }\n })\n\n function handleScroll () {\n if (!containerRef.value || !markerRef.value) return\n\n const scrollTop = containerRef.value.scrollTop\n const scrollTime = performance.now()\n const scrollDeltaT = scrollTime - lastScrollTime\n\n if (scrollDeltaT > 500) {\n scrollVelocity = Math.sign(scrollTop - lastScrollTop)\n\n // Not super important, only update at the\n // start of a scroll sequence to avoid reflows\n markerOffset = markerRef.value.offsetTop\n } else {\n scrollVelocity = scrollTop - lastScrollTop\n }\n\n lastScrollTop = scrollTop\n lastScrollTime = scrollTime\n\n calculateVisibleItems()\n }\n function handleScrollend () {\n if (!containerRef.value || !markerRef.value) return\n\n scrollVelocity = 0\n lastScrollTime = 0\n\n calculateVisibleItems()\n }\n\n let raf = -1\n function calculateVisibleItems () {\n cancelAnimationFrame(raf)\n raf = requestAnimationFrame(_calculateVisibleItems)\n }\n function _calculateVisibleItems () {\n if (!containerRef.value || !viewportHeight.value) return\n const scrollTop = lastScrollTop - markerOffset\n const direction = Math.sign(scrollVelocity)\n\n const startPx = Math.max(0, scrollTop - BUFFER_PX)\n const start = clamp(calculateIndex(startPx), 0, items.value.length)\n\n const endPx = scrollTop + viewportHeight.value + BUFFER_PX\n const end = clamp(calculateIndex(endPx) + 1, start + 1, items.value.length)\n\n if (\n // Only update the side we're scrolling towards,\n // the other side will be updated incidentally\n (direction !== UP || start < first.value) &&\n (direction !== DOWN || end > last.value)\n ) {\n const topOverflow = calculateOffset(first.value) - calculateOffset(start)\n const bottomOverflow = calculateOffset(end) - calculateOffset(last.value)\n const bufferOverflow = Math.max(topOverflow, bottomOverflow)\n\n if (bufferOverflow > BUFFER_PX) {\n first.value = start\n last.value = end\n } else {\n // Only update the side that's reached its limit if there's still buffer left\n if (start <= 0) first.value = start\n if (end >= items.value.length) last.value = end\n }\n }\n\n paddingTop.value = calculateOffset(first.value)\n paddingBottom.value = calculateOffset(items.value.length) - calculateOffset(last.value)\n }\n\n function scrollToIndex (index: number) {\n const offset = calculateOffset(index)\n if (!containerRef.value || (index && !offset)) {\n targetScrollIndex = index\n } else {\n containerRef.value.scrollTop = offset\n }\n }\n\n const computedItems = computed(() => {\n return items.value.slice(first.value, last.value).map((item, index) => ({\n raw: item,\n index: index + first.value,\n }))\n })\n\n watch(items, () => {\n sizes = Array.from({ length: items.value.length })\n offsets = Array.from({ length: items.value.length })\n updateOffsets.immediate()\n calculateVisibleItems()\n }, { deep: 1 })\n\n return {\n calculateVisibleItems,\n containerRef,\n markerRef,\n computedItems,\n paddingTop,\n paddingBottom,\n scrollToIndex,\n handleScroll,\n handleScrollend,\n handleItemResize,\n }\n}\n\n// https://gist.github.com/robertleeplummerjr/1cc657191d34ecd0a324\nfunction binaryClosest (arr: ArrayLike<number>, val: number) {\n let high = arr.length - 1\n let low = 0\n let mid = 0\n let item = null\n let target = -1\n\n if (arr[high]! < val) {\n return high\n }\n\n while (low <= high) {\n mid = (low + high) >> 1\n item = arr[mid]!\n\n if (item > val) {\n high = mid - 1\n } else if (item < val) {\n target = mid\n low = mid + 1\n } else if (item === val) {\n return mid\n } else {\n return low\n }\n }\n\n return target\n}\n"],"mappings":"AAAA;AAAA,SACS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AAIyB,IAAI,GAAGD,GAAG,CAACxD,MAAM,GAAG,CAAC;EACzB,IAAI0D,GAAG,GAAG,CAAC;EACX,IAAIC,GAAG,GAAG,CAAC;EACX,IAAIN,IAAI,GAAG,IAAI;EACf,IAAIO,MAAM,GAAG,CAAC,CAAC;EAEf,IAAIJ,GAAG,CAACC,IAAI,CAAC,GAAIzB,GAAG,EAAE;IACpB,OAAOyB,IAAI;EACb;EAEA,OAAOC,GAAG,IAAID,IAAI,EAAE;IAClBE,GAAG,GAAID,GAAG,GAAGD,IAAI,IAAK,CAAC;IACvBJ,IAAI,GAAGG,GAAG,CAACG,GAAG,CAAE;IAEhB,IAAIN,IAAI,GAAGrB,GAAG,EAAE;MACdyB,IAAI,GAAGE,GAAG,GAAG,CAAC;IAChB,CAAC,MAAM,IAAIN,IAAI,GAAGrB,GAAG,EAAE;MACrB4B,MAAM,GAAGD,GAAG;MACZD,GAAG,GAAGC,GAAG,GAAG,CAAC;IACf,CAAC,MAAM,IAAIN,IAAI,KAAKrB,GAAG,EAAE;MACvB,OAAO2B,GAAG;IACZ,CAAC,MAAM;MACL,OAAOD,GAAG;IACZ;EACF;EAEA,OAAOE,MAAM;AACf","ignoreList":[]}
|
1
|
+
{"version":3,"file":"virtual.mjs","names":["useDisplay","useResizeObserver","computed","nextTick","onScopeDispose","ref","shallowRef","watch","watchEffect","clamp","debounce","IN_BROWSER","propsFactory","UP","DOWN","BUFFER_PX","makeVirtualProps","itemHeight","type","Number","String","default","height","useVirtual","props","items","display","value","parseFloat","first","last","Math","ceil","parseInt","paddingTop","paddingBottom","containerRef","markerRef","markerOffset","resizeRef","contentRect","viewportHeight","document","documentElement","hasInitialRender","sizes","Array","from","length","offsets","updateTime","targetScrollIndex","getSize","index","updateOffsets","start","performance","now","i","max","unwatch","v","offsetTop","immediate","calculateVisibleItems","window","requestAnimationFrame","scrollToIndex","clear","handleItemResize","prevHeight","prevMinHeight","min","calculateOffset","calculateIndex","scrollTop","binaryClosest","lastScrollTop","scrollVelocity","lastScrollTime","val","oldVal","handleScroll","scrollTime","scrollDeltaT","sign","handleScrollend","raf","cancelAnimationFrame","_calculateVisibleItems","direction","startPx","endPx","end","topOverflow","bottomOverflow","bufferOverflow","offset","computedItems","slice","map","item","raw","deep","arr","high","low","mid","target"],"sources":["../../src/composables/virtual.ts"],"sourcesContent":["// Composables\nimport { useDisplay } from '@/composables/display'\nimport { useResizeObserver } from '@/composables/resizeObserver'\n\n// Utilities\nimport { computed, nextTick, onScopeDispose, ref, shallowRef, watch, watchEffect } from 'vue'\nimport { clamp, debounce, IN_BROWSER, propsFactory } from '@/util'\n\n// Types\nimport type { Ref } from 'vue'\n\nconst UP = -1\nconst DOWN = 1\n\n/** Determines how large each batch of items should be */\nconst BUFFER_PX = 100\n\ntype VirtualProps = {\n itemHeight?: number | string\n height?: number | string\n}\n\nexport const makeVirtualProps = propsFactory({\n itemHeight: {\n type: [Number, String],\n default: null,\n },\n height: [Number, String],\n}, 'virtual')\n\nexport function useVirtual <T> (props: VirtualProps, items: Ref<readonly T[]>) {\n const display = useDisplay()\n\n const itemHeight = shallowRef(0)\n watchEffect(() => {\n itemHeight.value = parseFloat(props.itemHeight || 0)\n })\n\n const first = shallowRef(0)\n const last = shallowRef(Math.ceil(\n // Assume 16px items filling the entire screen height if\n // not provided. This is probably incorrect but it minimises\n // the chance of ending up with empty space at the bottom.\n // The default value is set here to avoid poisoning getSize()\n (parseInt(props.height!) || display.height.value) / (itemHeight.value || 16)\n ) || 1)\n const paddingTop = shallowRef(0)\n const paddingBottom = shallowRef(0)\n\n /** The scrollable element */\n const containerRef = ref<HTMLElement>()\n /** An element marking the top of the scrollable area,\n * used to add an offset if there's padding or other elements above the virtual list */\n const markerRef = ref<HTMLElement>()\n /** markerRef's offsetTop, lazily evaluated */\n let markerOffset = 0\n\n const { resizeRef, contentRect } = useResizeObserver()\n watchEffect(() => {\n resizeRef.value = containerRef.value\n })\n const viewportHeight = computed(() => {\n return containerRef.value === document.documentElement\n ? display.height.value\n : contentRect.value?.height || parseInt(props.height!) || 0\n })\n /** All static elements have been rendered and we have an assumed item height */\n const hasInitialRender = computed(() => {\n return !!(containerRef.value && markerRef.value && viewportHeight.value && itemHeight.value)\n })\n\n let sizes = Array.from<number | null>({ length: items.value.length })\n let offsets = Array.from<number>({ length: items.value.length })\n const updateTime = shallowRef(0)\n let targetScrollIndex = -1\n\n function getSize (index: number) {\n return sizes[index] || itemHeight.value\n }\n\n const updateOffsets = debounce(() => {\n const start = performance.now()\n offsets[0] = 0\n const length = items.value.length\n for (let i = 1; i <= length - 1; i++) {\n offsets[i] = (offsets[i - 1] || 0) + getSize(i - 1)\n }\n updateTime.value = Math.max(updateTime.value, performance.now() - start)\n }, updateTime)\n\n const unwatch = watch(hasInitialRender, v => {\n if (!v) return\n // First render is complete, update offsets and visible\n // items in case our assumed item height was incorrect\n\n unwatch()\n markerOffset = markerRef.value!.offsetTop\n updateOffsets.immediate()\n calculateVisibleItems()\n\n if (!~targetScrollIndex) return\n\n nextTick(() => {\n IN_BROWSER && window.requestAnimationFrame(() => {\n scrollToIndex(targetScrollIndex)\n targetScrollIndex = -1\n })\n })\n })\n\n onScopeDispose(() => {\n updateOffsets.clear()\n })\n\n function handleItemResize (index: number, height: number) {\n const prevHeight = sizes[index]\n const prevMinHeight = itemHeight.value\n\n itemHeight.value = prevMinHeight ? Math.min(itemHeight.value, height) : height\n\n if (prevHeight !== height || prevMinHeight !== itemHeight.value) {\n sizes[index] = height\n updateOffsets()\n }\n }\n\n function calculateOffset (index: number) {\n index = clamp(index, 0, items.value.length - 1)\n return offsets[index] || 0\n }\n\n function calculateIndex (scrollTop: number) {\n return binaryClosest(offsets, scrollTop)\n }\n\n let lastScrollTop = 0\n let scrollVelocity = 0\n let lastScrollTime = 0\n\n watch(viewportHeight, (val, oldVal) => {\n if (oldVal) {\n calculateVisibleItems()\n if (val < oldVal) {\n requestAnimationFrame(() => {\n scrollVelocity = 0\n calculateVisibleItems()\n })\n }\n }\n })\n\n function handleScroll () {\n if (!containerRef.value || !markerRef.value) return\n\n const scrollTop = containerRef.value.scrollTop\n const scrollTime = performance.now()\n const scrollDeltaT = scrollTime - lastScrollTime\n\n if (scrollDeltaT > 500) {\n scrollVelocity = Math.sign(scrollTop - lastScrollTop)\n\n // Not super important, only update at the\n // start of a scroll sequence to avoid reflows\n markerOffset = markerRef.value.offsetTop\n } else {\n scrollVelocity = scrollTop - lastScrollTop\n }\n\n lastScrollTop = scrollTop\n lastScrollTime = scrollTime\n\n calculateVisibleItems()\n }\n function handleScrollend () {\n if (!containerRef.value || !markerRef.value) return\n\n scrollVelocity = 0\n lastScrollTime = 0\n\n calculateVisibleItems()\n }\n\n let raf = -1\n function calculateVisibleItems () {\n cancelAnimationFrame(raf)\n raf = requestAnimationFrame(_calculateVisibleItems)\n }\n function _calculateVisibleItems () {\n if (!containerRef.value || !viewportHeight.value) return\n const scrollTop = lastScrollTop - markerOffset\n const direction = Math.sign(scrollVelocity)\n\n const startPx = Math.max(0, scrollTop - BUFFER_PX)\n const start = clamp(calculateIndex(startPx), 0, items.value.length)\n\n const endPx = scrollTop + viewportHeight.value + BUFFER_PX\n const end = clamp(calculateIndex(endPx) + 1, start + 1, items.value.length)\n\n if (\n // Only update the side we're scrolling towards,\n // the other side will be updated incidentally\n (direction !== UP || start < first.value) &&\n (direction !== DOWN || end > last.value)\n ) {\n const topOverflow = calculateOffset(first.value) - calculateOffset(start)\n const bottomOverflow = calculateOffset(end) - calculateOffset(last.value)\n const bufferOverflow = Math.max(topOverflow, bottomOverflow)\n\n if (bufferOverflow > BUFFER_PX) {\n first.value = start\n last.value = end\n } else {\n // Only update the side that's reached its limit if there's still buffer left\n if (start <= 0) first.value = start\n if (end >= items.value.length) last.value = end\n }\n }\n\n paddingTop.value = calculateOffset(first.value)\n paddingBottom.value = calculateOffset(items.value.length) - calculateOffset(last.value)\n }\n\n function scrollToIndex (index: number) {\n const offset = calculateOffset(index)\n if (!containerRef.value || (index && !offset)) {\n targetScrollIndex = index\n } else {\n containerRef.value.scrollTop = offset\n }\n }\n\n const computedItems = computed(() => {\n return items.value.slice(first.value, last.value).map((item, index) => ({\n raw: item,\n index: index + first.value,\n }))\n })\n\n watch(items, () => {\n sizes = Array.from({ length: items.value.length })\n offsets = Array.from({ length: items.value.length })\n updateOffsets.immediate()\n calculateVisibleItems()\n }, { deep: true })\n\n return {\n calculateVisibleItems,\n containerRef,\n markerRef,\n computedItems,\n paddingTop,\n paddingBottom,\n scrollToIndex,\n handleScroll,\n handleScrollend,\n handleItemResize,\n }\n}\n\n// https://gist.github.com/robertleeplummerjr/1cc657191d34ecd0a324\nfunction binaryClosest (arr: ArrayLike<number>, val: number) {\n let high = arr.length - 1\n let low = 0\n let mid = 0\n let item = null\n let target = -1\n\n if (arr[high]! < val) {\n return high\n }\n\n while (low <= high) {\n mid = (low + high) >> 1\n item = arr[mid]!\n\n if (item > val) {\n high = mid - 1\n } else if (item < val) {\n target = mid\n low = mid + 1\n } else if (item === val) {\n return mid\n } else {\n return low\n }\n }\n\n return target\n}\n"],"mappings":"AAAA;AAAA,SACSA,UAAU;AAAA,SACVC,iBAAiB,gCAE1B;AACA,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,cAAc,EAAEC,GAAG,EAAEC,UAAU,EAAEC,KAAK,EAAEC,WAAW,QAAQ,KAAK;AAAA,SACpFC,KAAK,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,YAAY,6BAElD;AAGA,MAAMC,EAAE,GAAG,CAAC,CAAC;AACb,MAAMC,IAAI,GAAG,CAAC;;AAEd;AACA,MAAMC,SAAS,GAAG,GAAG;AAOrB,OAAO,MAAMC,gBAAgB,GAAGJ,YAAY,CAAC;EAC3CK,UAAU,EAAE;IACVC,IAAI,EAAE,CAACC,MAAM,EAAEC,MAAM,CAAC;IACtBC,OAAO,EAAE;EACX,CAAC;EACDC,MAAM,EAAE,CAACH,MAAM,EAAEC,MAAM;AACzB,CAAC,EAAE,SAAS,CAAC;AAEb,OAAO,SAASG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D,GAAG,GAAGC,GAAG,GAAG,CAAC;IACf,CAAC,MAAM,IAAIN,IAAI,KAAKrB,GAAG,EAAE;MACvB,OAAO2B,GAAG;IACZ,CAAC,MAAM;MACL,OAAOD,GAAG;IACZ;EACF;EAEA,OAAOE,MAAM;AACf","ignoreList":[]}
|
@@ -1,39 +1,37 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
.
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
.
|
36
|
-
|
37
|
-
opacity: 0;
|
38
|
-
}
|
1
|
+
.v-ripple__container {
|
2
|
+
color: inherit;
|
3
|
+
border-radius: inherit;
|
4
|
+
position: absolute;
|
5
|
+
width: 100%;
|
6
|
+
height: 100%;
|
7
|
+
left: 0;
|
8
|
+
top: 0;
|
9
|
+
overflow: hidden;
|
10
|
+
z-index: 0;
|
11
|
+
pointer-events: none;
|
12
|
+
contain: strict;
|
13
|
+
}
|
14
|
+
.v-ripple__animation {
|
15
|
+
color: inherit;
|
16
|
+
position: absolute;
|
17
|
+
top: 0;
|
18
|
+
left: 0;
|
19
|
+
border-radius: 50%;
|
20
|
+
background: currentColor;
|
21
|
+
opacity: 0;
|
22
|
+
pointer-events: none;
|
23
|
+
overflow: hidden;
|
24
|
+
will-change: transform, opacity;
|
25
|
+
}
|
26
|
+
.v-ripple__animation--enter {
|
27
|
+
transition: none;
|
28
|
+
opacity: 0;
|
29
|
+
}
|
30
|
+
.v-ripple__animation--in {
|
31
|
+
transition: transform 0.25s cubic-bezier(0, 0, 0.2, 1), opacity 0.1s cubic-bezier(0, 0, 0.2, 1);
|
32
|
+
opacity: calc(0.25 * var(--v-theme-overlay-multiplier));
|
33
|
+
}
|
34
|
+
.v-ripple__animation--out {
|
35
|
+
transition: opacity 0.3s cubic-bezier(0, 0, 0.2, 1);
|
36
|
+
opacity: 0;
|
39
37
|
}
|
package/lib/entry-bundler.mjs
CHANGED
@@ -16,7 +16,7 @@ export const createVuetify = function () {
|
|
16
16
|
...options
|
17
17
|
});
|
18
18
|
};
|
19
|
-
export const version = "3.7.
|
19
|
+
export const version = "3.7.5-master.2024-12-03";
|
20
20
|
createVuetify.version = version;
|
21
21
|
export { blueprints, components, directives };
|
22
22
|
export * from "./composables/index.mjs";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"entry-bundler.mjs","names":["blueprints","components","directives","createVuetify","_createVuetify","options","arguments","length","undefined","version"],"sources":["../src/entry-bundler.ts"],"sourcesContent":["/* eslint-disable local-rules/sort-imports */\n\n// Styles\nimport './styles/main.sass'\n\n// Components\nimport * as blueprints from './blueprints'\nimport * as components from './components'\nimport * as directives from './directives'\nimport { createVuetify as _createVuetify } from './framework'\n\n// Types\nimport type { VuetifyOptions } from './framework'\n\nexport const createVuetify = (options: VuetifyOptions = {}) => {\n return _createVuetify({ components, directives, ...options })\n}\n\nexport const version = __VUETIFY_VERSION__\ncreateVuetify.version = version\n\nexport {\n blueprints,\n components,\n directives,\n}\nexport * from './composables'\n"],"mappings":"AAAA;;AAEA;AACA;;AAEA;AAAA,OACO,KAAKA,UAAU;AAAA,OACf,KAAKC,UAAU;AAAA,OACf,KAAKC,UAAU;AAAA,SACbC,aAAa,IAAIC,cAAc,2BAExC;AAGA,OAAO,MAAMD,aAAa,GAAG,SAAAA,CAAA,EAAkC;EAAA,IAAjCE,OAAuB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EACxD,OAAOF,cAAc,CAAC;IAAEH,UAAU;IAAEC,UAAU;IAAE,GAAGG;EAAQ,CAAC,CAAC;AAC/D,CAAC;AAED,OAAO,MAAMI,OAAO,
|
1
|
+
{"version":3,"file":"entry-bundler.mjs","names":["blueprints","components","directives","createVuetify","_createVuetify","options","arguments","length","undefined","version"],"sources":["../src/entry-bundler.ts"],"sourcesContent":["/* eslint-disable local-rules/sort-imports */\n\n// Styles\nimport './styles/main.sass'\n\n// Components\nimport * as blueprints from './blueprints'\nimport * as components from './components'\nimport * as directives from './directives'\nimport { createVuetify as _createVuetify } from './framework'\n\n// Types\nimport type { VuetifyOptions } from './framework'\n\nexport const createVuetify = (options: VuetifyOptions = {}) => {\n return _createVuetify({ components, directives, ...options })\n}\n\nexport const version = __VUETIFY_VERSION__\ncreateVuetify.version = version\n\nexport {\n blueprints,\n components,\n directives,\n}\nexport * from './composables'\n"],"mappings":"AAAA;;AAEA;AACA;;AAEA;AAAA,OACO,KAAKA,UAAU;AAAA,OACf,KAAKC,UAAU;AAAA,OACf,KAAKC,UAAU;AAAA,SACbC,aAAa,IAAIC,cAAc,2BAExC;AAGA,OAAO,MAAMD,aAAa,GAAG,SAAAA,CAAA,EAAkC;EAAA,IAAjCE,OAAuB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EACxD,OAAOF,cAAc,CAAC;IAAEH,UAAU;IAAEC,UAAU;IAAE,GAAGG;EAAQ,CAAC,CAAC;AAC/D,CAAC;AAED,OAAO,MAAMI,OAAO,4BAAsB;AAC1CN,aAAa,CAACM,OAAO,GAAGA,OAAO;AAE/B,SACET,UAAU,EACVC,UAAU,EACVC,UAAU;AACX","ignoreList":[]}
|
package/lib/framework.mjs
CHANGED