vuetify 3.0.0-beta.9 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_settings.scss +2 -0
- package/_styles.scss +1 -0
- package/_tools.scss +1 -0
- package/dist/json/attributes.json +3756 -2480
- package/dist/json/importMap.json +26 -30
- package/dist/json/tags.json +484 -56
- package/dist/json/web-types.json +14630 -10836
- package/dist/vuetify.css +1348 -2099
- package/dist/vuetify.d.ts +20046 -10128
- package/dist/vuetify.esm.js +2267 -2923
- package/dist/vuetify.esm.js.map +1 -1
- package/dist/vuetify.js +2242 -2899
- package/dist/vuetify.js.map +1 -1
- package/dist/vuetify.min.css +3 -3
- package/dist/vuetify.min.js +1226 -1239
- package/dist/vuetify.min.js.map +1 -1
- package/lib/blueprints/index.d.ts +163 -0
- package/lib/blueprints/index.mjs.map +1 -1
- package/lib/blueprints/md1.d.ts +159 -0
- package/lib/blueprints/md1.mjs +3 -1
- package/lib/blueprints/md1.mjs.map +1 -1
- package/lib/blueprints/md2.d.ts +159 -0
- package/lib/blueprints/md2.mjs +3 -1
- package/lib/blueprints/md2.mjs.map +1 -1
- package/lib/blueprints/md3.d.ts +159 -0
- package/lib/blueprints/md3.mjs +2 -2
- package/lib/blueprints/md3.mjs.map +1 -1
- package/lib/components/VAlert/VAlert.css +2 -3
- package/lib/components/VAlert/VAlert.mjs +10 -23
- package/lib/components/VAlert/VAlert.mjs.map +1 -1
- package/lib/components/VAlert/VAlertTitle.mjs.map +1 -1
- package/lib/components/VAlert/index.d.ts +187 -0
- package/lib/components/VAlert/index.mjs.map +1 -1
- package/lib/components/VApp/VApp.css +0 -11
- package/lib/components/VApp/VApp.mjs +5 -7
- package/lib/components/VApp/VApp.mjs.map +1 -1
- package/lib/components/VApp/VApp.sass +0 -9
- package/lib/components/VApp/index.d.ts +85 -0
- package/lib/components/VApp/index.mjs.map +1 -1
- package/lib/components/VAppBar/VAppBar.css +4 -1
- package/lib/components/VAppBar/VAppBar.mjs +7 -11
- package/lib/components/VAppBar/VAppBar.mjs.map +1 -1
- package/lib/components/VAppBar/VAppBar.sass +3 -0
- package/lib/components/VAppBar/VAppBarNavIcon.mjs +0 -4
- package/lib/components/VAppBar/VAppBarNavIcon.mjs.map +1 -1
- package/lib/components/VAppBar/VAppBarTitle.mjs +2 -4
- package/lib/components/VAppBar/VAppBarTitle.mjs.map +1 -1
- package/lib/components/VAppBar/index.d.ts +160 -0
- package/lib/components/VAppBar/index.mjs.map +1 -1
- package/lib/components/VAutocomplete/VAutocomplete.css +19 -2
- package/lib/components/VAutocomplete/VAutocomplete.mjs +50 -47
- package/lib/components/VAutocomplete/VAutocomplete.mjs.map +1 -1
- package/lib/components/VAutocomplete/VAutocomplete.sass +11 -1
- package/lib/components/VAutocomplete/_variables.scss +1 -0
- package/lib/components/VAutocomplete/index.d.ts +1520 -0
- package/lib/components/VAutocomplete/index.mjs.map +1 -1
- package/lib/components/VAvatar/VAvatar.css +45 -2
- package/lib/components/VAvatar/VAvatar.mjs +19 -19
- package/lib/components/VAvatar/VAvatar.mjs.map +1 -1
- package/lib/components/VAvatar/VAvatar.sass +6 -1
- package/lib/components/VAvatar/_variables.scss +9 -4
- package/lib/components/VAvatar/index.d.ts +82 -0
- package/lib/components/VAvatar/index.mjs.map +1 -1
- package/lib/components/VBadge/VBadge.mjs +3 -9
- package/lib/components/VBadge/VBadge.mjs.map +1 -1
- package/lib/components/VBadge/index.d.ts +123 -0
- package/lib/components/VBadge/index.mjs.map +1 -1
- package/lib/components/VBanner/VBanner.css +1 -1
- package/lib/components/VBanner/VBanner.mjs +5 -7
- package/lib/components/VBanner/VBanner.mjs.map +1 -1
- package/lib/components/VBanner/VBannerActions.mjs +0 -4
- package/lib/components/VBanner/VBannerActions.mjs.map +1 -1
- package/lib/components/VBanner/VBannerText.mjs.map +1 -1
- package/lib/components/VBanner/index.d.ts +126 -0
- package/lib/components/VBanner/index.mjs.map +1 -1
- package/lib/components/VBottomNavigation/VBottomNavigation.css +1 -1
- package/lib/components/VBottomNavigation/VBottomNavigation.mjs +3 -6
- package/lib/components/VBottomNavigation/VBottomNavigation.mjs.map +1 -1
- package/lib/components/VBottomNavigation/index.d.ts +145 -0
- package/lib/components/VBottomNavigation/index.mjs.map +1 -1
- package/lib/components/VBottomSheet/VBottomSheet.mjs +5 -5
- package/lib/components/VBottomSheet/VBottomSheet.mjs.map +1 -1
- package/lib/components/VBottomSheet/index.mjs.map +1 -1
- package/lib/components/VBreadcrumbs/VBreadcrumbs.mjs +8 -12
- package/lib/components/VBreadcrumbs/VBreadcrumbs.mjs.map +1 -1
- package/lib/components/VBreadcrumbs/VBreadcrumbsDivider.mjs.map +1 -1
- package/lib/components/VBreadcrumbs/VBreadcrumbsItem.mjs +4 -9
- package/lib/components/VBreadcrumbs/VBreadcrumbsItem.mjs.map +1 -1
- package/lib/components/VBreadcrumbs/index.d.ts +311 -0
- package/lib/components/VBreadcrumbs/index.mjs.map +1 -1
- package/lib/components/VBtn/VBtn.css +14 -10
- package/lib/components/VBtn/VBtn.mjs +22 -20
- package/lib/components/VBtn/VBtn.mjs.map +1 -1
- package/lib/components/VBtn/index.d.ts +212 -0
- package/lib/components/VBtn/index.mjs.map +1 -1
- package/lib/components/VBtnGroup/VBtnGroup.css +1 -1
- package/lib/components/VBtnGroup/VBtnGroup.mjs +2 -4
- package/lib/components/VBtnGroup/VBtnGroup.mjs.map +1 -1
- package/lib/components/VBtnGroup/index.d.ts +68 -0
- package/lib/components/VBtnGroup/index.mjs.map +1 -1
- package/lib/components/VBtnToggle/VBtnToggle.mjs +3 -10
- package/lib/components/VBtnToggle/VBtnToggle.mjs.map +1 -1
- package/lib/components/VBtnToggle/index.d.ts +170 -0
- package/lib/components/VBtnToggle/index.mjs.map +1 -1
- package/lib/components/VCalendar/VCalendar.mjs +6 -67
- package/lib/components/VCalendar/VCalendar.mjs.map +1 -1
- package/lib/components/VCalendar/VCalendarCategory.mjs +7 -18
- package/lib/components/VCalendar/VCalendarCategory.mjs.map +1 -1
- package/lib/components/VCalendar/VCalendarDaily.mjs +3 -34
- package/lib/components/VCalendar/VCalendarDaily.mjs.map +1 -1
- package/lib/components/VCalendar/VCalendarMonthly.mjs +3 -7
- package/lib/components/VCalendar/VCalendarMonthly.mjs.map +1 -1
- package/lib/components/VCalendar/VCalendarWeekly.mjs +3 -32
- package/lib/components/VCalendar/VCalendarWeekly.mjs.map +1 -1
- package/lib/components/VCalendar/index.mjs.map +1 -1
- package/lib/components/VCalendar/mixins/calendar-base.mjs +1 -19
- package/lib/components/VCalendar/mixins/calendar-base.mjs.map +1 -1
- package/lib/components/VCalendar/mixins/calendar-with-events.mjs +16 -84
- package/lib/components/VCalendar/mixins/calendar-with-events.mjs.map +1 -1
- package/lib/components/VCalendar/mixins/calendar-with-intervals.mjs +0 -30
- package/lib/components/VCalendar/mixins/calendar-with-intervals.mjs.map +1 -1
- package/lib/components/VCalendar/mixins/mouse.mjs +7 -17
- package/lib/components/VCalendar/mixins/mouse.mjs.map +1 -1
- package/lib/components/VCalendar/mixins/times.mjs +1 -9
- package/lib/components/VCalendar/mixins/times.mjs.map +1 -1
- package/lib/components/VCalendar/modes/column.mjs +0 -3
- package/lib/components/VCalendar/modes/column.mjs.map +1 -1
- package/lib/components/VCalendar/modes/common.mjs +0 -14
- package/lib/components/VCalendar/modes/common.mjs.map +1 -1
- package/lib/components/VCalendar/modes/index.mjs +0 -1
- package/lib/components/VCalendar/modes/index.mjs.map +1 -1
- package/lib/components/VCalendar/modes/stack.mjs +3 -45
- package/lib/components/VCalendar/modes/stack.mjs.map +1 -1
- package/lib/components/VCalendar/util/events.mjs +0 -1
- package/lib/components/VCalendar/util/events.mjs.map +1 -1
- package/lib/components/VCalendar/util/parser.mjs +3 -4
- package/lib/components/VCalendar/util/parser.mjs.map +1 -1
- package/lib/components/VCalendar/util/props.mjs +0 -13
- package/lib/components/VCalendar/util/props.mjs.map +1 -1
- package/lib/components/VCalendar/util/timestamp.mjs +2 -64
- package/lib/components/VCalendar/util/timestamp.mjs.map +1 -1
- package/lib/components/VCard/VCard.css +13 -9
- package/lib/components/VCard/VCard.mjs +6 -11
- package/lib/components/VCard/VCard.mjs.map +1 -1
- package/lib/components/VCard/VCardActions.mjs +0 -4
- package/lib/components/VCard/VCardActions.mjs.map +1 -1
- package/lib/components/VCard/VCardItem.mjs +5 -10
- package/lib/components/VCard/VCardItem.mjs.map +1 -1
- package/lib/components/VCard/VCardSubtitle.mjs.map +1 -1
- package/lib/components/VCard/VCardText.mjs.map +1 -1
- package/lib/components/VCard/VCardTitle.mjs.map +1 -1
- package/lib/components/VCard/index.d.ts +237 -0
- package/lib/components/VCard/index.mjs.map +1 -1
- package/lib/components/VCarousel/VCarousel.mjs +8 -12
- package/lib/components/VCarousel/VCarousel.mjs.map +1 -1
- package/lib/components/VCarousel/VCarouselItem.mjs +0 -3
- package/lib/components/VCarousel/VCarouselItem.mjs.map +1 -1
- package/lib/components/VCarousel/index.d.ts +81 -0
- package/lib/components/VCarousel/index.mjs.map +1 -1
- package/lib/components/VCheckbox/VCheckbox.mjs +22 -9
- package/lib/components/VCheckbox/VCheckbox.mjs.map +1 -1
- package/lib/components/VCheckbox/VCheckboxBtn.mjs +7 -15
- package/lib/components/VCheckbox/VCheckboxBtn.mjs.map +1 -1
- package/lib/components/VCheckbox/index.d.ts +302 -0
- package/lib/components/VCheckbox/index.mjs.map +1 -1
- package/lib/components/VChip/VChip.css +27 -3
- package/lib/components/VChip/VChip.mjs +5 -13
- package/lib/components/VChip/VChip.mjs.map +1 -1
- package/lib/components/VChip/VChip.sass +1 -0
- package/lib/components/VChip/index.d.ts +197 -0
- package/lib/components/VChip/index.mjs.map +1 -1
- package/lib/components/VChipGroup/VChipGroup.mjs +5 -6
- package/lib/components/VChipGroup/VChipGroup.mjs.map +1 -1
- package/lib/components/VChipGroup/index.d.ts +89 -0
- package/lib/components/VChipGroup/index.mjs.map +1 -1
- package/lib/components/VCode/VCode.css +5 -3
- package/lib/components/VCode/VCode.sass +3 -1
- package/lib/components/VCode/_variables.scss +5 -3
- package/lib/components/VCode/index.d.ts +20 -0
- package/lib/components/VCode/index.mjs.map +1 -1
- package/lib/components/VColorPicker/VColorPicker.css +3 -3
- package/lib/components/VColorPicker/VColorPicker.mjs +54 -61
- package/lib/components/VColorPicker/VColorPicker.mjs.map +1 -1
- package/lib/components/VColorPicker/VColorPickerCanvas.mjs +10 -25
- package/lib/components/VColorPicker/VColorPickerCanvas.mjs.map +1 -1
- package/lib/components/VColorPicker/VColorPickerEdit.mjs +6 -10
- package/lib/components/VColorPicker/VColorPickerEdit.mjs.map +1 -1
- package/lib/components/VColorPicker/VColorPickerPreview.mjs +14 -24
- package/lib/components/VColorPicker/VColorPickerPreview.mjs.map +1 -1
- package/lib/components/VColorPicker/VColorPickerSwatches.mjs +2 -6
- package/lib/components/VColorPicker/VColorPickerSwatches.mjs.map +1 -1
- package/lib/components/VColorPicker/index.d.ts +116 -0
- package/lib/components/VColorPicker/index.mjs.map +1 -1
- package/lib/components/VColorPicker/util/index.mjs +25 -29
- package/lib/components/VColorPicker/util/index.mjs.map +1 -1
- package/lib/components/VCombobox/VCombobox.css +14 -1
- package/lib/components/VCombobox/VCombobox.mjs +56 -62
- package/lib/components/VCombobox/VCombobox.mjs.map +1 -1
- package/lib/components/VCombobox/VCombobox.sass +5 -0
- package/lib/components/VCombobox/_variables.scss +1 -0
- package/lib/components/VCombobox/index.d.ts +1541 -0
- package/lib/components/VCombobox/index.mjs.map +1 -1
- package/lib/components/VCounter/VCounter.mjs +2 -5
- package/lib/components/VCounter/VCounter.mjs.map +1 -1
- package/lib/components/VCounter/index.d.ts +224 -0
- package/lib/components/VCounter/index.mjs.map +1 -1
- package/lib/components/VData/VData.mjs +9 -67
- package/lib/components/VData/VData.mjs.map +1 -1
- package/lib/components/VData/index.mjs.map +1 -1
- package/lib/components/VDataIterator/VDataFooter.mjs +6 -25
- package/lib/components/VDataIterator/VDataFooter.mjs.map +1 -1
- package/lib/components/VDataIterator/VDataIterator.mjs +12 -51
- package/lib/components/VDataIterator/VDataIterator.mjs.map +1 -1
- package/lib/components/VDataIterator/index.mjs.map +1 -1
- package/lib/components/VDataTable/MobileRow.mjs +3 -8
- package/lib/components/VDataTable/MobileRow.mjs.map +1 -1
- package/lib/components/VDataTable/Row.mjs +1 -8
- package/lib/components/VDataTable/Row.mjs.map +1 -1
- package/lib/components/VDataTable/RowGroup.mjs +1 -7
- package/lib/components/VDataTable/RowGroup.mjs.map +1 -1
- package/lib/components/VDataTable/VDataTable.mjs +53 -105
- package/lib/components/VDataTable/VDataTable.mjs.map +1 -1
- package/lib/components/VDataTable/VDataTableHeader.mjs +6 -10
- package/lib/components/VDataTable/VDataTableHeader.mjs.map +1 -1
- package/lib/components/VDataTable/VDataTableHeaderDesktop.mjs +0 -18
- package/lib/components/VDataTable/VDataTableHeaderDesktop.mjs.map +1 -1
- package/lib/components/VDataTable/VDataTableHeaderMobile.mjs +0 -9
- package/lib/components/VDataTable/VDataTableHeaderMobile.mjs.map +1 -1
- package/lib/components/VDataTable/VEditDialog.mjs +3 -17
- package/lib/components/VDataTable/VEditDialog.mjs.map +1 -1
- package/lib/components/VDataTable/VVirtualTable.mjs +3 -28
- package/lib/components/VDataTable/VVirtualTable.mjs.map +1 -1
- package/lib/components/VDataTable/index.mjs +0 -1
- package/lib/components/VDataTable/index.mjs.map +1 -1
- package/lib/components/VDataTable/mixins/header.mjs +1 -8
- package/lib/components/VDataTable/mixins/header.mjs.map +1 -1
- package/lib/components/VDatePicker/VDatePicker.mjs +2 -69
- package/lib/components/VDatePicker/VDatePicker.mjs.map +1 -1
- package/lib/components/VDatePicker/VDatePickerDateTable.mjs +1 -29
- package/lib/components/VDatePicker/VDatePickerDateTable.mjs.map +1 -1
- package/lib/components/VDatePicker/VDatePickerHeader.mjs +4 -17
- package/lib/components/VDatePicker/VDatePickerHeader.mjs.map +1 -1
- package/lib/components/VDatePicker/VDatePickerMonthTable.mjs +1 -12
- package/lib/components/VDatePicker/VDatePickerMonthTable.mjs.map +1 -1
- package/lib/components/VDatePicker/VDatePickerTitle.mjs +4 -15
- package/lib/components/VDatePicker/VDatePickerTitle.mjs.map +1 -1
- package/lib/components/VDatePicker/VDatePickerYears.mjs +4 -18
- package/lib/components/VDatePicker/VDatePickerYears.mjs.map +1 -1
- package/lib/components/VDatePicker/index.mjs.map +1 -1
- package/lib/components/VDatePicker/mixins/date-picker-table.mjs +6 -33
- package/lib/components/VDatePicker/mixins/date-picker-table.mjs.map +1 -1
- package/lib/components/VDatePicker/util/createNativeLocaleFormatter.mjs +0 -5
- package/lib/components/VDatePicker/util/createNativeLocaleFormatter.mjs.map +1 -1
- package/lib/components/VDatePicker/util/eventHelpers.mjs +2 -3
- package/lib/components/VDatePicker/util/eventHelpers.mjs.map +1 -1
- package/lib/components/VDatePicker/util/index.mjs +0 -1
- package/lib/components/VDatePicker/util/index.mjs.map +1 -1
- package/lib/components/VDatePicker/util/isDateAllowed.mjs +1 -1
- package/lib/components/VDatePicker/util/isDateAllowed.mjs.map +1 -1
- package/lib/components/VDatePicker/util/monthChange.mjs +0 -3
- package/lib/components/VDatePicker/util/monthChange.mjs.map +1 -1
- package/lib/components/VDatePicker/util/pad.mjs +1 -6
- package/lib/components/VDatePicker/util/pad.mjs.map +1 -1
- package/lib/components/VDatePicker/util/sanitizeDateString.mjs.map +1 -1
- package/lib/components/VDefaultsProvider/VDefaultsProvider.mjs +2 -4
- package/lib/components/VDefaultsProvider/VDefaultsProvider.mjs.map +1 -1
- package/lib/components/VDefaultsProvider/index.d.ts +27 -0
- package/lib/components/VDefaultsProvider/index.mjs.map +1 -1
- package/lib/components/VDialog/VDialog.css +4 -1
- package/lib/components/VDialog/VDialog.mjs +49 -59
- package/lib/components/VDialog/VDialog.mjs.map +1 -1
- package/lib/components/VDialog/VDialog.sass +3 -0
- package/lib/components/VDialog/index.d.ts +1795 -0
- package/lib/components/VDialog/index.mjs.map +1 -1
- package/lib/components/VDivider/VDivider.mjs +2 -8
- package/lib/components/VDivider/VDivider.mjs.map +1 -1
- package/lib/components/VDivider/index.d.ts +23 -0
- package/lib/components/VDivider/index.mjs.map +1 -1
- package/lib/components/VExpansionPanel/VExpansionPanel.css +9 -4
- package/lib/components/VExpansionPanel/VExpansionPanel.mjs +0 -5
- package/lib/components/VExpansionPanel/VExpansionPanel.mjs.map +1 -1
- package/lib/components/VExpansionPanel/VExpansionPanelText.mjs +2 -6
- package/lib/components/VExpansionPanel/VExpansionPanelText.mjs.map +1 -1
- package/lib/components/VExpansionPanel/VExpansionPanelTitle.mjs +3 -8
- package/lib/components/VExpansionPanel/VExpansionPanelTitle.mjs.map +1 -1
- package/lib/components/VExpansionPanel/VExpansionPanels.mjs +2 -5
- package/lib/components/VExpansionPanel/VExpansionPanels.mjs.map +1 -1
- package/lib/components/VExpansionPanel/index.d.ts +206 -0
- package/lib/components/VExpansionPanel/index.mjs.map +1 -1
- package/lib/components/VField/VField.css +29 -26
- package/lib/components/VField/VField.mjs +36 -35
- package/lib/components/VField/VField.mjs.map +1 -1
- package/lib/components/VField/VField.sass +23 -22
- package/lib/components/VField/VFieldLabel.mjs +0 -3
- package/lib/components/VField/VFieldLabel.mjs.map +1 -1
- package/lib/components/VField/index.d.ts +306 -0
- package/lib/components/VField/index.mjs.map +1 -1
- package/lib/components/VFileInput/VFileInput.css +16 -0
- package/lib/components/VFileInput/VFileInput.mjs +41 -60
- package/lib/components/VFileInput/VFileInput.mjs.map +1 -1
- package/lib/components/VFileInput/VFileInput.sass +10 -0
- package/lib/components/VFileInput/_variables.scss +2 -0
- package/lib/components/VFileInput/index.d.ts +477 -0
- package/lib/components/VFileInput/index.mjs.map +1 -1
- package/lib/components/VFooter/VFooter.css +8 -1
- package/lib/components/VFooter/VFooter.mjs +2 -4
- package/lib/components/VFooter/VFooter.mjs.map +1 -1
- package/lib/components/VFooter/VFooter.sass +1 -1
- package/lib/components/VFooter/_variables.scss +11 -0
- package/lib/components/VFooter/index.d.ts +77 -0
- package/lib/components/VFooter/index.mjs.map +1 -1
- package/lib/components/VForm/VForm.mjs +2 -13
- package/lib/components/VForm/VForm.mjs.map +1 -1
- package/lib/components/VForm/index.d.ts +81 -0
- package/lib/components/VForm/index.mjs.map +1 -1
- package/lib/components/VGrid/VCol.mjs +8 -23
- package/lib/components/VGrid/VCol.mjs.map +1 -1
- package/lib/components/VGrid/VContainer.mjs +2 -4
- package/lib/components/VGrid/VContainer.mjs.map +1 -1
- package/lib/components/VGrid/VRow.mjs +6 -24
- package/lib/components/VGrid/VRow.mjs.map +1 -1
- package/lib/components/VGrid/VSpacer.mjs.map +1 -1
- package/lib/components/VGrid/index.d.ts +156 -0
- package/lib/components/VGrid/index.mjs.map +1 -1
- package/lib/components/VHover/VHover.mjs +0 -4
- package/lib/components/VHover/VHover.mjs.map +1 -1
- package/lib/components/VHover/index.d.ts +31 -0
- package/lib/components/VHover/index.mjs.map +1 -1
- package/lib/components/VIcon/VIcon.mjs +4 -9
- package/lib/components/VIcon/VIcon.mjs.map +1 -1
- package/lib/components/VIcon/index.d.ts +125 -0
- package/lib/components/VIcon/index.mjs.map +1 -1
- package/lib/components/VImg/VImg.mjs +36 -60
- package/lib/components/VImg/VImg.mjs.map +1 -1
- package/lib/components/VImg/index.d.ts +93 -0
- package/lib/components/VImg/index.mjs.map +1 -1
- package/lib/components/VInput/InputIcon.mjs +31 -0
- package/lib/components/VInput/InputIcon.mjs.map +1 -0
- package/lib/components/VInput/VInput.mjs +20 -20
- package/lib/components/VInput/VInput.mjs.map +1 -1
- package/lib/components/VInput/index.d.ts +320 -0
- package/lib/components/VInput/index.mjs.map +1 -1
- package/lib/components/VItemGroup/VItem.mjs +0 -5
- package/lib/components/VItemGroup/VItem.mjs.map +1 -1
- package/lib/components/VItemGroup/VItemGroup.mjs +4 -6
- package/lib/components/VItemGroup/VItemGroup.mjs.map +1 -1
- package/lib/components/VItemGroup/index.d.ts +204 -0
- package/lib/components/VItemGroup/index.mjs.map +1 -1
- package/lib/components/VKbd/VKbd.css +3 -3
- package/lib/components/VKbd/VKbd.sass +2 -2
- package/lib/components/VKbd/index.d.ts +20 -0
- package/lib/components/VKbd/index.mjs.map +1 -1
- package/lib/components/VLabel/VLabel.css +4 -1
- package/lib/components/VLabel/VLabel.mjs +6 -6
- package/lib/components/VLabel/VLabel.mjs.map +1 -1
- package/lib/components/VLabel/VLabel.sass +3 -1
- package/lib/components/VLabel/index.d.ts +16 -0
- package/lib/components/VLabel/index.mjs.map +1 -1
- package/lib/components/VLayout/VLayout.mjs +2 -5
- package/lib/components/VLayout/VLayout.mjs.map +1 -1
- package/lib/components/VLayout/VLayoutItem.mjs +2 -6
- package/lib/components/VLayout/VLayoutItem.mjs.map +1 -1
- package/lib/components/VLayout/index.d.ts +78 -0
- package/lib/components/VLayout/index.mjs.map +1 -1
- package/lib/components/VLazy/VLazy.mjs +0 -8
- package/lib/components/VLazy/VLazy.mjs.map +1 -1
- package/lib/components/VLazy/index.d.ts +86 -0
- package/lib/components/VLazy/index.mjs.map +1 -1
- package/lib/components/VList/VList.css +1 -1
- package/lib/components/VList/VList.mjs +73 -24
- package/lib/components/VList/VList.mjs.map +1 -1
- package/lib/components/VList/VListChildren.mjs +22 -31
- package/lib/components/VList/VListChildren.mjs.map +1 -1
- package/lib/components/VList/VListGroup.mjs +11 -17
- package/lib/components/VList/VListGroup.mjs.map +1 -1
- package/lib/components/VList/VListImg.mjs.map +1 -1
- package/lib/components/VList/VListItem.css +12 -8
- package/lib/components/VList/VListItem.mjs +42 -42
- package/lib/components/VList/VListItem.mjs.map +1 -1
- package/lib/components/VList/VListItem.sass +2 -2
- package/lib/components/VList/VListItemAction.mjs +0 -3
- package/lib/components/VList/VListItemAction.mjs.map +1 -1
- package/lib/components/VList/VListItemMedia.mjs +0 -3
- package/lib/components/VList/VListItemMedia.mjs.map +1 -1
- package/lib/components/VList/VListItemSubtitle.mjs.map +1 -1
- package/lib/components/VList/VListItemTitle.mjs.map +1 -1
- package/lib/components/VList/VListSubheader.mjs +2 -6
- package/lib/components/VList/VListSubheader.mjs.map +1 -1
- package/lib/components/VList/index.d.ts +1242 -0
- package/lib/components/VList/index.mjs.map +1 -1
- package/lib/components/VList/list.mjs +5 -2
- package/lib/components/VList/list.mjs.map +1 -1
- package/lib/components/VLocaleProvider/VLocaleProvider.mjs +4 -9
- package/lib/components/VLocaleProvider/VLocaleProvider.mjs.map +1 -1
- package/lib/components/VLocaleProvider/index.d.ts +24 -0
- package/lib/components/VLocaleProvider/index.mjs.map +1 -1
- package/lib/components/VMain/VMain.css +0 -7
- package/lib/components/VMain/VMain.mjs +2 -5
- package/lib/components/VMain/VMain.mjs.map +1 -1
- package/lib/components/VMain/VMain.sass +0 -8
- package/lib/components/VMain/index.d.ts +27 -0
- package/lib/components/VMain/index.mjs.map +1 -1
- package/lib/components/VMenu/VMenu.css +1 -1
- package/lib/components/VMenu/VMenu.mjs +45 -43
- package/lib/components/VMenu/VMenu.mjs.map +1 -1
- package/lib/components/VMenu/index.d.ts +1823 -0
- package/lib/components/VMenu/index.mjs.map +1 -1
- package/lib/components/VMenu/shared.mjs.map +1 -1
- package/lib/components/VMessages/VMessages.mjs +2 -6
- package/lib/components/VMessages/VMessages.mjs.map +1 -1
- package/lib/components/VMessages/index.d.ts +235 -0
- package/lib/components/VMessages/index.mjs.map +1 -1
- package/lib/components/VNavigationDrawer/VNavigationDrawer.css +2 -2
- package/lib/components/VNavigationDrawer/VNavigationDrawer.mjs +6 -11
- package/lib/components/VNavigationDrawer/VNavigationDrawer.mjs.map +1 -1
- package/lib/components/VNavigationDrawer/VNavigationDrawer.sass +1 -1
- package/lib/components/VNavigationDrawer/_variables.scss +1 -0
- package/lib/components/VNavigationDrawer/index.d.ts +148 -0
- package/lib/components/VNavigationDrawer/index.mjs.map +1 -1
- package/lib/components/VNavigationDrawer/sticky.mjs +1 -7
- package/lib/components/VNavigationDrawer/sticky.mjs.map +1 -1
- package/lib/components/VNavigationDrawer/touch.mjs +2 -15
- package/lib/components/VNavigationDrawer/touch.mjs.map +1 -1
- package/lib/components/VNoSsr/VNoSsr.mjs +0 -4
- package/lib/components/VNoSsr/VNoSsr.mjs.map +1 -1
- package/lib/components/VNoSsr/index.d.ts +8 -0
- package/lib/components/VNoSsr/index.mjs.map +1 -1
- package/lib/components/VOtpInput/VOtpInput.mjs +7 -58
- package/lib/components/VOtpInput/VOtpInput.mjs.map +1 -1
- package/lib/components/VOtpInput/index.mjs.map +1 -1
- package/lib/components/VOverflowBtn/VOverflowBtn.mjs +7 -19
- package/lib/components/VOverflowBtn/VOverflowBtn.mjs.map +1 -1
- package/lib/components/VOverflowBtn/index.mjs.map +1 -1
- package/lib/components/VOverlay/VOverlay.mjs +47 -53
- package/lib/components/VOverlay/VOverlay.mjs.map +1 -1
- package/lib/components/VOverlay/index.d.ts +551 -0
- package/lib/components/VOverlay/index.mjs.map +1 -1
- package/lib/components/VOverlay/locationStrategies.mjs +34 -58
- package/lib/components/VOverlay/locationStrategies.mjs.map +1 -1
- package/lib/components/VOverlay/requestNewFrame.mjs +1 -2
- package/lib/components/VOverlay/requestNewFrame.mjs.map +1 -1
- package/lib/components/VOverlay/scrollStrategies.mjs +10 -29
- package/lib/components/VOverlay/scrollStrategies.mjs.map +1 -1
- package/lib/components/VOverlay/useActivator.mjs +29 -29
- package/lib/components/VOverlay/useActivator.mjs.map +1 -1
- package/lib/components/VOverlay/util/point.mjs +3 -4
- package/lib/components/VOverlay/util/point.mjs.map +1 -1
- package/lib/components/VPagination/VPagination.mjs +20 -30
- package/lib/components/VPagination/VPagination.mjs.map +1 -1
- package/lib/components/VPagination/index.d.ts +249 -0
- package/lib/components/VPagination/index.mjs.map +1 -1
- package/lib/components/VParallax/VParallax.mjs +32 -24
- package/lib/components/VParallax/VParallax.mjs.map +1 -1
- package/lib/components/VParallax/index.d.ts +18 -0
- package/lib/components/VParallax/index.mjs.map +1 -1
- package/lib/components/VPicker/VPicker.mjs +3 -12
- package/lib/components/VPicker/VPicker.mjs.map +1 -1
- package/lib/components/VPicker/index.mjs.map +1 -1
- package/lib/components/VProgressCircular/VProgressCircular.mjs +2 -5
- package/lib/components/VProgressCircular/VProgressCircular.mjs.map +1 -1
- package/lib/components/VProgressCircular/index.d.ts +69 -0
- package/lib/components/VProgressCircular/index.mjs.map +1 -1
- package/lib/components/VProgressLinear/VProgressLinear.mjs +5 -8
- package/lib/components/VProgressLinear/VProgressLinear.mjs.map +1 -1
- package/lib/components/VProgressLinear/index.d.ts +102 -0
- package/lib/components/VProgressLinear/index.mjs.map +1 -1
- package/lib/components/VRadio/VRadio.mjs +2 -4
- package/lib/components/VRadio/VRadio.mjs.map +1 -1
- package/lib/components/VRadio/index.d.ts +105 -0
- package/lib/components/VRadio/index.mjs.map +1 -1
- package/lib/components/VRadioGroup/VRadioGroup.css +2 -3
- package/lib/components/VRadioGroup/VRadioGroup.mjs +17 -21
- package/lib/components/VRadioGroup/VRadioGroup.mjs.map +1 -1
- package/lib/components/VRadioGroup/VRadioGroup.sass +2 -2
- package/lib/components/VRadioGroup/_variables.scss +0 -1
- package/lib/components/VRadioGroup/index.d.ts +179 -0
- package/lib/components/VRadioGroup/index.mjs.map +1 -1
- package/lib/components/VRangeSlider/VRangeSlider.mjs +24 -27
- package/lib/components/VRangeSlider/VRangeSlider.mjs.map +1 -1
- package/lib/components/VRangeSlider/index.d.ts +246 -0
- package/lib/components/VRangeSlider/index.mjs.map +1 -1
- package/lib/components/VRating/VRating.mjs +6 -30
- package/lib/components/VRating/VRating.mjs.map +1 -1
- package/lib/components/VRating/index.d.ts +348 -0
- package/lib/components/VRating/index.mjs.map +1 -1
- package/lib/components/VResponsive/VResponsive.mjs +2 -5
- package/lib/components/VResponsive/VResponsive.mjs.map +1 -1
- package/lib/components/VResponsive/index.d.ts +24 -0
- package/lib/components/VResponsive/index.mjs.map +1 -1
- package/lib/components/VSelect/VSelect.css +21 -2
- package/lib/components/VSelect/VSelect.mjs +53 -38
- package/lib/components/VSelect/VSelect.mjs.map +1 -1
- package/lib/components/VSelect/VSelect.sass +16 -1
- package/lib/components/VSelect/_variables.scss +1 -0
- package/lib/components/VSelect/index.d.ts +1484 -0
- package/lib/components/VSelect/index.mjs.map +1 -1
- package/lib/components/VSelectionControl/VSelectionControl.mjs +17 -62
- package/lib/components/VSelectionControl/VSelectionControl.mjs.map +1 -1
- package/lib/components/VSelectionControl/index.d.ts +259 -0
- package/lib/components/VSelectionControl/index.mjs.map +1 -1
- package/lib/components/VSelectionControlGroup/VSelectionControlGroup.css +6 -0
- package/lib/components/VSelectionControlGroup/VSelectionControlGroup.mjs +59 -29
- package/lib/components/VSelectionControlGroup/VSelectionControlGroup.mjs.map +1 -1
- package/lib/components/VSelectionControlGroup/VSelectionControlGroup.sass +6 -0
- package/lib/components/VSelectionControlGroup/index.d.ts +96 -0
- package/lib/components/VSelectionControlGroup/index.mjs.map +1 -1
- package/lib/components/VSheet/VSheet.css +1 -1
- package/lib/components/VSheet/VSheet.mjs +2 -4
- package/lib/components/VSheet/VSheet.mjs.map +1 -1
- package/lib/components/VSheet/index.d.ts +69 -0
- package/lib/components/VSheet/index.mjs.map +1 -1
- package/lib/components/VSkeletonLoader/VSkeletonLoader.mjs +19 -32
- package/lib/components/VSkeletonLoader/VSkeletonLoader.mjs.map +1 -1
- package/lib/components/VSkeletonLoader/index.mjs.map +1 -1
- package/lib/components/VSlideGroup/VSlideGroup.mjs +56 -78
- package/lib/components/VSlideGroup/VSlideGroup.mjs.map +1 -1
- package/lib/components/VSlideGroup/VSlideGroupItem.mjs +5 -9
- package/lib/components/VSlideGroup/VSlideGroupItem.mjs.map +1 -1
- package/lib/components/VSlideGroup/helpers.mjs +4 -17
- package/lib/components/VSlideGroup/helpers.mjs.map +1 -1
- package/lib/components/VSlideGroup/index.d.ts +434 -0
- package/lib/components/VSlideGroup/index.mjs.map +1 -1
- package/lib/components/VSlider/VSlider.css +7 -2
- package/lib/components/VSlider/VSlider.mjs +19 -12
- package/lib/components/VSlider/VSlider.mjs.map +1 -1
- package/lib/components/VSlider/VSlider.sass +6 -2
- package/lib/components/VSlider/VSliderThumb.css +10 -6
- package/lib/components/VSlider/VSliderThumb.mjs +7 -18
- package/lib/components/VSlider/VSliderThumb.mjs.map +1 -1
- package/lib/components/VSlider/VSliderThumb.sass +11 -8
- package/lib/components/VSlider/VSliderTrack.css +20 -20
- package/lib/components/VSlider/VSliderTrack.mjs +16 -14
- package/lib/components/VSlider/VSliderTrack.mjs.map +1 -1
- package/lib/components/VSlider/VSliderTrack.sass +14 -14
- package/lib/components/VSlider/_variables.scss +2 -2
- package/lib/components/VSlider/index.d.ts +243 -0
- package/lib/components/VSlider/index.mjs.map +1 -1
- package/lib/components/VSlider/slider.mjs +15 -46
- package/lib/components/VSlider/slider.mjs.map +1 -1
- package/lib/components/VSnackbar/VSnackbar.css +2 -3
- package/lib/components/VSnackbar/VSnackbar.mjs +51 -60
- package/lib/components/VSnackbar/VSnackbar.mjs.map +1 -1
- package/lib/components/VSnackbar/index.d.ts +1696 -0
- package/lib/components/VSnackbar/index.mjs.map +1 -1
- package/lib/components/VSparkline/VSparkline.mjs +5 -40
- package/lib/components/VSparkline/VSparkline.mjs.map +1 -1
- package/lib/components/VSparkline/helpers/core.mjs +1 -1
- package/lib/components/VSparkline/helpers/core.mjs.map +1 -1
- package/lib/components/VSparkline/helpers/math.mjs +2 -3
- package/lib/components/VSparkline/helpers/math.mjs.map +1 -1
- package/lib/components/VSparkline/helpers/path.mjs +0 -4
- package/lib/components/VSparkline/helpers/path.mjs.map +1 -1
- package/lib/components/VSparkline/index.mjs.map +1 -1
- package/lib/components/VSpeedDial/VSpeedDial.mjs +3 -12
- package/lib/components/VSpeedDial/VSpeedDial.mjs.map +1 -1
- package/lib/components/VSpeedDial/index.mjs.map +1 -1
- package/lib/components/VStepper/VStepper.mjs +5 -24
- package/lib/components/VStepper/VStepper.mjs.map +1 -1
- package/lib/components/VStepper/VStepperContent.mjs +4 -25
- package/lib/components/VStepper/VStepperContent.mjs.map +1 -1
- package/lib/components/VStepper/VStepperStep.mjs +0 -24
- package/lib/components/VStepper/VStepperStep.mjs.map +1 -1
- package/lib/components/VStepper/index.mjs.map +1 -1
- package/lib/components/VSwitch/VSwitch.css +2 -2
- package/lib/components/VSwitch/VSwitch.mjs +26 -17
- package/lib/components/VSwitch/VSwitch.mjs.map +1 -1
- package/lib/components/VSwitch/index.d.ts +186 -0
- package/lib/components/VSwitch/index.mjs.map +1 -1
- package/lib/components/VSystemBar/VSystemBar.css +1 -1
- package/lib/components/VSystemBar/VSystemBar.mjs +3 -9
- package/lib/components/VSystemBar/VSystemBar.mjs.map +1 -1
- package/lib/components/VSystemBar/index.d.ts +62 -0
- package/lib/components/VSystemBar/index.mjs.map +1 -1
- package/lib/components/VTable/VTable.css +3 -3
- package/lib/components/VTable/VTable.mjs +5 -6
- package/lib/components/VTable/VTable.mjs.map +1 -1
- package/lib/components/VTable/VTable.sass +9 -3
- package/lib/components/VTable/index.d.ts +44 -0
- package/lib/components/VTable/index.mjs.map +1 -1
- package/lib/components/VTabs/VTab.css +3 -1
- package/lib/components/VTabs/VTab.mjs +5 -12
- package/lib/components/VTabs/VTab.mjs.map +1 -1
- package/lib/components/VTabs/VTab.sass +3 -1
- package/lib/components/VTabs/VTabs.css +7 -7
- package/lib/components/VTabs/VTabs.mjs +18 -21
- package/lib/components/VTabs/VTabs.mjs.map +1 -1
- package/lib/components/VTabs/VTabs.sass +5 -5
- package/lib/components/VTabs/_variables.scss +1 -1
- package/lib/components/VTabs/index.d.ts +186 -0
- package/lib/components/VTabs/index.mjs.map +1 -1
- package/lib/components/VTabs/shared.mjs.map +1 -1
- package/lib/components/VTextField/VTextField.css +2 -3
- package/lib/components/VTextField/VTextField.mjs +32 -38
- package/lib/components/VTextField/VTextField.mjs.map +1 -1
- package/lib/components/VTextField/VTextField.sass +2 -4
- package/lib/components/VTextField/index.d.ts +1807 -0
- package/lib/components/VTextField/index.mjs.map +1 -1
- package/lib/components/VTextarea/VTextarea.css +5 -3
- package/lib/components/VTextarea/VTextarea.mjs +26 -33
- package/lib/components/VTextarea/VTextarea.mjs.map +1 -1
- package/lib/components/VTextarea/VTextarea.sass +5 -4
- package/lib/components/VTextarea/index.d.ts +461 -0
- package/lib/components/VTextarea/index.mjs.map +1 -1
- package/lib/components/VThemeProvider/VThemeProvider.mjs +2 -5
- package/lib/components/VThemeProvider/VThemeProvider.mjs.map +1 -1
- package/lib/components/VThemeProvider/index.d.ts +25 -0
- package/lib/components/VThemeProvider/index.mjs.map +1 -1
- package/lib/components/VTimePicker/SelectingTimes.mjs +0 -3
- package/lib/components/VTimePicker/SelectingTimes.mjs.map +1 -1
- package/lib/components/VTimePicker/VTimePicker.mjs +3 -53
- package/lib/components/VTimePicker/VTimePicker.mjs.map +1 -1
- package/lib/components/VTimePicker/VTimePickerClock.mjs +6 -42
- package/lib/components/VTimePicker/VTimePickerClock.mjs.map +1 -1
- package/lib/components/VTimePicker/VTimePickerTitle.mjs +4 -13
- package/lib/components/VTimePicker/VTimePickerTitle.mjs.map +1 -1
- package/lib/components/VTimePicker/index.mjs.map +1 -1
- package/lib/components/VTimeline/VTimeline.css +77 -41
- package/lib/components/VTimeline/VTimeline.mjs +8 -10
- package/lib/components/VTimeline/VTimeline.mjs.map +1 -1
- package/lib/components/VTimeline/VTimeline.sass +95 -64
- package/lib/components/VTimeline/VTimelineDivider.mjs +2 -7
- package/lib/components/VTimeline/VTimelineDivider.mjs.map +1 -1
- package/lib/components/VTimeline/VTimelineItem.mjs +2 -8
- package/lib/components/VTimeline/VTimelineItem.mjs.map +1 -1
- package/lib/components/VTimeline/_mixins.sass +10 -0
- package/lib/components/VTimeline/_variables.scss +4 -3
- package/lib/components/VTimeline/index.d.ts +158 -0
- package/lib/components/VTimeline/index.mjs.map +1 -1
- package/lib/components/VToolbar/VToolbar.css +3 -4
- package/lib/components/VToolbar/VToolbar.mjs +3 -11
- package/lib/components/VToolbar/VToolbar.mjs.map +1 -1
- package/lib/components/VToolbar/VToolbar.sass +0 -1
- package/lib/components/VToolbar/VToolbarItems.mjs +0 -4
- package/lib/components/VToolbar/VToolbarItems.mjs.map +1 -1
- package/lib/components/VToolbar/VToolbarTitle.mjs +0 -5
- package/lib/components/VToolbar/VToolbarTitle.mjs.map +1 -1
- package/lib/components/VToolbar/_variables.scss +1 -1
- package/lib/components/VToolbar/index.d.ts +377 -0
- package/lib/components/VToolbar/index.mjs.map +1 -1
- package/lib/components/VTooltip/VTooltip.mjs +46 -57
- package/lib/components/VTooltip/VTooltip.mjs.map +1 -1
- package/lib/components/VTooltip/index.d.ts +1789 -0
- package/lib/components/VTooltip/index.mjs.map +1 -1
- package/lib/components/VTreeview/VTreeview.mjs +18 -75
- package/lib/components/VTreeview/VTreeview.mjs.map +1 -1
- package/lib/components/VTreeview/VTreeviewNode.mjs +2 -32
- package/lib/components/VTreeview/VTreeviewNode.mjs.map +1 -1
- package/lib/components/VTreeview/index.mjs.map +1 -1
- package/lib/components/VTreeview/util/filterTreeItems.mjs +0 -6
- package/lib/components/VTreeview/util/filterTreeItems.mjs.map +1 -1
- package/lib/components/VValidation/VValidation.mjs +2 -5
- package/lib/components/VValidation/VValidation.mjs.map +1 -1
- package/lib/components/VValidation/index.d.ts +67 -0
- package/lib/components/VValidation/index.mjs.map +1 -1
- package/lib/components/VVirtualScroll/VVirtualScroll.mjs +3 -18
- package/lib/components/VVirtualScroll/VVirtualScroll.mjs.map +1 -1
- package/lib/components/VVirtualScroll/index.mjs.map +1 -1
- package/lib/components/VWindow/VWindow.mjs +6 -22
- package/lib/components/VWindow/VWindow.mjs.map +1 -1
- package/lib/components/VWindow/VWindowItem.mjs +8 -21
- package/lib/components/VWindow/VWindowItem.mjs.map +1 -1
- package/lib/components/VWindow/index.d.ts +378 -0
- package/lib/components/VWindow/index.mjs.map +1 -1
- package/lib/components/index.d.ts +18364 -8683
- package/lib/components/index.mjs +0 -11
- package/lib/components/index.mjs.map +1 -1
- package/lib/components/transitions/createTransition.mjs +0 -10
- package/lib/components/transitions/createTransition.mjs.map +1 -1
- package/lib/components/transitions/dialog-transition.mjs +8 -23
- package/lib/components/transitions/dialog-transition.mjs.map +1 -1
- package/lib/components/transitions/expand-transition.mjs +2 -11
- package/lib/components/transitions/expand-transition.mjs.map +1 -1
- package/lib/components/transitions/index.d.ts +470 -0
- package/lib/components/transitions/index.mjs +5 -4
- package/lib/components/transitions/index.mjs.map +1 -1
- package/lib/composables/border.mjs +0 -3
- package/lib/composables/border.mjs.map +1 -1
- package/lib/composables/color.mjs +0 -4
- package/lib/composables/color.mjs.map +1 -1
- package/lib/composables/defaults.mjs +1 -6
- package/lib/composables/defaults.mjs.map +1 -1
- package/lib/composables/delay.mjs +1 -6
- package/lib/composables/delay.mjs.map +1 -1
- package/lib/composables/density.mjs +4 -1
- package/lib/composables/density.mjs.map +1 -1
- package/lib/composables/dimensions.mjs +0 -1
- package/lib/composables/dimensions.mjs.map +1 -1
- package/lib/composables/display.mjs +8 -21
- package/lib/composables/display.mjs.map +1 -1
- package/lib/composables/elevation.mjs +2 -4
- package/lib/composables/elevation.mjs.map +1 -1
- package/lib/composables/filter.mjs +11 -20
- package/lib/composables/filter.mjs.map +1 -1
- package/lib/composables/focus.mjs +0 -5
- package/lib/composables/focus.mjs.map +1 -1
- package/lib/composables/form.mjs +8 -16
- package/lib/composables/form.mjs.map +1 -1
- package/lib/composables/forwardRefs.mjs +9 -16
- package/lib/composables/forwardRefs.mjs.map +1 -1
- package/lib/composables/group.mjs +11 -38
- package/lib/composables/group.mjs.map +1 -1
- package/lib/composables/hydration.mjs +0 -1
- package/lib/composables/hydration.mjs.map +1 -1
- package/lib/composables/icons.mjs +5 -18
- package/lib/composables/icons.mjs.map +1 -1
- package/lib/composables/index.mjs +1 -2
- package/lib/composables/index.mjs.map +1 -1
- package/lib/composables/intersectionObserver.mjs +0 -3
- package/lib/composables/intersectionObserver.mjs.map +1 -1
- package/lib/composables/items.mjs +5 -17
- package/lib/composables/items.mjs.map +1 -1
- package/lib/composables/layout.mjs +31 -37
- package/lib/composables/layout.mjs.map +1 -1
- package/lib/composables/lazy.mjs +2 -3
- package/lib/composables/lazy.mjs.map +1 -1
- package/lib/composables/loader.mjs +0 -3
- package/lib/composables/loader.mjs.map +1 -1
- package/lib/composables/locale.mjs +48 -127
- package/lib/composables/locale.mjs.map +1 -1
- package/lib/composables/location.mjs +1 -8
- package/lib/composables/location.mjs.map +1 -1
- package/lib/composables/mutationObserver.mjs +7 -7
- package/lib/composables/mutationObserver.mjs.map +1 -1
- package/lib/composables/nested/nested.mjs +21 -38
- package/lib/composables/nested/nested.mjs.map +1 -1
- package/lib/composables/nested/openStrategies.mjs +0 -9
- package/lib/composables/nested/openStrategies.mjs.map +1 -1
- package/lib/composables/nested/selectStrategies.mjs +6 -21
- package/lib/composables/nested/selectStrategies.mjs.map +1 -1
- package/lib/composables/position.mjs +1 -4
- package/lib/composables/position.mjs.map +1 -1
- package/lib/composables/proxiedModel.mjs +28 -16
- package/lib/composables/proxiedModel.mjs.map +1 -1
- package/lib/composables/refs.mjs +0 -2
- package/lib/composables/refs.mjs.map +1 -1
- package/lib/composables/resizeObserver.mjs +0 -3
- package/lib/composables/resizeObserver.mjs.map +1 -1
- package/lib/composables/rounded.mjs +0 -3
- package/lib/composables/rounded.mjs.map +1 -1
- package/lib/composables/router.mjs +12 -12
- package/lib/composables/router.mjs.map +1 -1
- package/lib/composables/scopeId.mjs.map +1 -1
- package/lib/composables/scroll.mjs +4 -12
- package/lib/composables/scroll.mjs.map +1 -1
- package/lib/composables/selectLink.mjs +7 -6
- package/lib/composables/selectLink.mjs.map +1 -1
- package/lib/composables/size.mjs +0 -3
- package/lib/composables/size.mjs.map +1 -1
- package/lib/composables/ssrBoot.mjs +2 -1
- package/lib/composables/ssrBoot.mjs.map +1 -1
- package/lib/composables/stack.mjs +0 -6
- package/lib/composables/stack.mjs.map +1 -1
- package/lib/composables/tag.mjs +0 -1
- package/lib/composables/tag.mjs.map +1 -1
- package/lib/composables/teleport.mjs +0 -4
- package/lib/composables/teleport.mjs.map +1 -1
- package/lib/composables/theme.mjs +65 -81
- package/lib/composables/theme.mjs.map +1 -1
- package/lib/composables/toggleScope.mjs +0 -1
- package/lib/composables/toggleScope.mjs.map +1 -1
- package/lib/composables/touch.mjs +6 -31
- package/lib/composables/touch.mjs.map +1 -1
- package/lib/composables/transition.mjs +0 -4
- package/lib/composables/transition.mjs.map +1 -1
- package/lib/composables/validation.mjs +29 -27
- package/lib/composables/validation.mjs.map +1 -1
- package/lib/composables/variant.mjs +0 -2
- package/lib/composables/variant.mjs.map +1 -1
- package/lib/directives/click-outside/index.mjs +10 -22
- package/lib/directives/click-outside/index.mjs.map +1 -1
- package/lib/directives/color/index.mjs +0 -11
- package/lib/directives/color/index.mjs.map +1 -1
- package/lib/directives/index.d.ts +104 -13
- package/lib/directives/index.mjs +0 -1
- package/lib/directives/index.mjs.map +1 -1
- package/lib/directives/intersect/index.mjs +3 -10
- package/lib/directives/intersect/index.mjs.map +1 -1
- package/lib/directives/mutate/index.mjs +5 -11
- package/lib/directives/mutate/index.mjs.map +1 -1
- package/lib/directives/resize/index.mjs +0 -5
- package/lib/directives/resize/index.mjs.map +1 -1
- package/lib/directives/ripple/index.mjs +12 -66
- package/lib/directives/ripple/index.mjs.map +1 -1
- package/lib/directives/scroll/index.mjs +1 -7
- package/lib/directives/scroll/index.mjs.map +1 -1
- package/lib/directives/touch/index.mjs +3 -18
- package/lib/directives/touch/index.mjs.map +1 -1
- package/lib/entry-bundler.mjs +2 -1
- package/lib/entry-bundler.mjs.map +1 -1
- package/lib/framework.mjs +60 -61
- package/lib/framework.mjs.map +1 -1
- package/lib/iconsets/fa-svg.mjs +0 -1
- package/lib/iconsets/fa-svg.mjs.map +1 -1
- package/lib/iconsets/fa.mjs +0 -1
- package/lib/iconsets/fa.mjs.map +1 -1
- package/lib/iconsets/fa4.mjs +4 -3
- package/lib/iconsets/fa4.mjs.map +1 -1
- package/lib/iconsets/md.mjs +4 -3
- package/lib/iconsets/md.mjs.map +1 -1
- package/lib/iconsets/mdi-svg.mjs +1 -1
- package/lib/iconsets/mdi-svg.mjs.map +1 -1
- package/lib/iconsets/mdi.mjs +4 -3
- package/lib/iconsets/mdi.mjs.map +1 -1
- package/lib/index.d.ts +109 -110
- package/lib/locale/adapters/vue-i18n.d.ts +29 -0
- package/lib/locale/adapters/vue-i18n.mjs +59 -54
- package/lib/locale/adapters/vue-i18n.mjs.map +1 -1
- package/lib/locale/adapters/vuetify.d.ts +24 -0
- package/lib/locale/adapters/vuetify.mjs +97 -0
- package/lib/locale/adapters/vuetify.mjs.map +1 -0
- package/lib/locale/af.mjs +5 -0
- package/lib/locale/af.mjs.map +1 -1
- package/lib/locale/ar.mjs +5 -0
- package/lib/locale/ar.mjs.map +1 -1
- package/lib/locale/az.mjs +5 -0
- package/lib/locale/az.mjs.map +1 -1
- package/lib/locale/bg.mjs +5 -0
- package/lib/locale/bg.mjs.map +1 -1
- package/lib/locale/ca.mjs +5 -0
- package/lib/locale/ca.mjs.map +1 -1
- package/lib/locale/ckb.mjs +5 -0
- package/lib/locale/ckb.mjs.map +1 -1
- package/lib/locale/cs.mjs +5 -0
- package/lib/locale/cs.mjs.map +1 -1
- package/lib/locale/da.mjs +5 -0
- package/lib/locale/da.mjs.map +1 -1
- package/lib/locale/de.mjs +5 -0
- package/lib/locale/de.mjs.map +1 -1
- package/lib/locale/el.mjs +5 -0
- package/lib/locale/el.mjs.map +1 -1
- package/lib/locale/en.mjs +5 -0
- package/lib/locale/en.mjs.map +1 -1
- package/lib/locale/es.mjs +5 -0
- package/lib/locale/es.mjs.map +1 -1
- package/lib/locale/et.mjs +5 -0
- package/lib/locale/et.mjs.map +1 -1
- package/lib/locale/fa.mjs +5 -0
- package/lib/locale/fa.mjs.map +1 -1
- package/lib/locale/fi.mjs +5 -0
- package/lib/locale/fi.mjs.map +1 -1
- package/lib/locale/fr.mjs +5 -0
- package/lib/locale/fr.mjs.map +1 -1
- package/lib/locale/he.mjs +5 -0
- package/lib/locale/he.mjs.map +1 -1
- package/lib/locale/hr.mjs +5 -0
- package/lib/locale/hr.mjs.map +1 -1
- package/lib/locale/hu.mjs +5 -0
- package/lib/locale/hu.mjs.map +1 -1
- package/lib/locale/id.mjs +5 -0
- package/lib/locale/id.mjs.map +1 -1
- package/lib/locale/index.d.ts +212 -2
- package/lib/locale/index.mjs +1 -1
- package/lib/locale/index.mjs.map +1 -1
- package/lib/locale/it.mjs +5 -0
- package/lib/locale/it.mjs.map +1 -1
- package/lib/locale/ja.mjs +5 -0
- package/lib/locale/ja.mjs.map +1 -1
- package/lib/locale/ko.mjs +5 -0
- package/lib/locale/ko.mjs.map +1 -1
- package/lib/locale/lt.mjs +5 -0
- package/lib/locale/lt.mjs.map +1 -1
- package/lib/locale/lv.mjs +5 -0
- package/lib/locale/lv.mjs.map +1 -1
- package/lib/locale/nl.mjs +5 -0
- package/lib/locale/nl.mjs.map +1 -1
- package/lib/locale/no.mjs +5 -0
- package/lib/locale/no.mjs.map +1 -1
- package/lib/locale/pl.mjs +9 -4
- package/lib/locale/pl.mjs.map +1 -1
- package/lib/locale/pt.mjs +5 -0
- package/lib/locale/pt.mjs.map +1 -1
- package/lib/locale/ro.mjs +5 -0
- package/lib/locale/ro.mjs.map +1 -1
- package/lib/locale/ru.mjs +5 -0
- package/lib/locale/ru.mjs.map +1 -1
- package/lib/locale/sk.mjs +5 -0
- package/lib/locale/sk.mjs.map +1 -1
- package/lib/locale/sl.mjs +5 -0
- package/lib/locale/sl.mjs.map +1 -1
- package/lib/locale/sr-Cyrl.mjs +5 -0
- package/lib/locale/sr-Cyrl.mjs.map +1 -1
- package/lib/locale/sr-Latn.mjs +5 -0
- package/lib/locale/sr-Latn.mjs.map +1 -1
- package/lib/locale/sv.mjs +5 -0
- package/lib/locale/sv.mjs.map +1 -1
- package/lib/locale/th.mjs +5 -0
- package/lib/locale/th.mjs.map +1 -1
- package/lib/locale/tr.mjs +5 -0
- package/lib/locale/tr.mjs.map +1 -1
- package/lib/locale/uk.mjs +5 -0
- package/lib/locale/uk.mjs.map +1 -1
- package/lib/locale/vi.mjs +5 -0
- package/lib/locale/vi.mjs.map +1 -1
- package/lib/locale/zh-Hans.mjs +5 -0
- package/lib/locale/zh-Hans.mjs.map +1 -1
- package/lib/locale/zh-Hant.mjs +5 -0
- package/lib/locale/zh-Hant.mjs.map +1 -1
- package/lib/services/goto/easing-patterns.mjs +24 -24
- package/lib/services/goto/easing-patterns.mjs.map +1 -1
- package/lib/services/goto/index.mjs +11 -15
- package/lib/services/goto/index.mjs.map +1 -1
- package/lib/services/goto/util.mjs +1 -8
- package/lib/services/goto/util.mjs.map +1 -1
- package/lib/styles/main.css +105 -101
- package/lib/styles/settings/_colors.scss +84 -84
- package/lib/styles/settings/_elevations.scss +3 -3
- package/lib/styles/settings/_utilities.scss +11 -4
- package/lib/styles/tools/_states.sass +8 -3
- package/lib/styles/tools/_variant.sass +0 -1
- package/lib/util/anchor.mjs +0 -3
- package/lib/util/anchor.mjs.map +1 -1
- package/lib/util/animation.mjs +14 -4
- package/lib/util/animation.mjs.map +1 -1
- package/lib/util/box.mjs +0 -5
- package/lib/util/box.mjs.map +1 -1
- package/lib/util/color/APCA.mjs +23 -21
- package/lib/util/color/APCA.mjs.map +1 -1
- package/lib/util/color/transformCIELAB.mjs +0 -2
- package/lib/util/color/transformCIELAB.mjs.map +1 -1
- package/lib/util/color/transformSRGB.mjs +14 -12
- package/lib/util/color/transformSRGB.mjs.map +1 -1
- package/lib/util/colorUtils.mjs +8 -25
- package/lib/util/colorUtils.mjs.map +1 -1
- package/lib/util/colors.mjs.map +1 -1
- package/lib/util/console.mjs +5 -14
- package/lib/util/console.mjs.map +1 -1
- package/lib/util/createSimpleFunctional.mjs +1 -4
- package/lib/util/createSimpleFunctional.mjs.map +1 -1
- package/lib/util/dateTimeUtils.mjs +0 -10
- package/lib/util/dateTimeUtils.mjs.map +1 -1
- package/lib/util/defineComponent.mjs +12 -36
- package/lib/util/defineComponent.mjs.map +1 -1
- package/lib/util/dom.mjs +4 -4
- package/lib/util/dom.mjs.map +1 -1
- package/lib/util/easing.mjs +0 -1
- package/lib/util/easing.mjs.map +1 -1
- package/lib/util/getCurrentInstance.mjs +3 -10
- package/lib/util/getCurrentInstance.mjs.map +1 -1
- package/lib/util/getScrollParent.mjs +3 -4
- package/lib/util/getScrollParent.mjs.map +1 -1
- package/lib/util/globals.mjs +1 -1
- package/lib/util/globals.mjs.map +1 -1
- package/lib/util/helpers.mjs +46 -85
- package/lib/util/helpers.mjs.map +1 -1
- package/lib/util/injectSelf.mjs +0 -1
- package/lib/util/injectSelf.mjs.map +1 -1
- package/lib/util/isFixedPosition.mjs +0 -2
- package/lib/util/isFixedPosition.mjs.map +1 -1
- package/lib/util/propsFactory.mjs +4 -5
- package/lib/util/propsFactory.mjs.map +1 -1
- package/lib/util/useRender.mjs +0 -1
- package/lib/util/useRender.mjs.map +1 -1
- package/package.json +17 -19
- package/lib/composables/rtl.mjs +0 -44
- package/lib/composables/rtl.mjs.map +0 -1
- package/lib/locale/adapters/vue-intl.mjs +0 -67
- package/lib/locale/adapters/vue-intl.mjs.map +0 -1
- package/lib/styles.scss +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.mjs","names":["computed","inject","provide","reactive","ref","watch","watchEffect","colorToInt","colorToRGB","createRange","darken","getCurrentInstance","getLuma","IN_BROWSER","intToHex","lighten","mergeDeep","propsFactory","APCAcontrast","ThemeSymbol","Symbol","for","makeThemeProps","theme","String","defaultThemeOptions","defaultTheme","variations","colors","themes","light","dark","background","surface","primary","secondary","error","info","success","warning","variables","parseThemeOptions","options","isDisabled","key","Object","entries","createTheme","app","head","_context","provides","usehead","parsedOptions","name","computedThemes","acc","original","value","color","variation","fn","amount","keys","test","onColor","colorVal","blackContrast","Math","abs","whiteContrast","min","current","styles","lines","createCssClass","themeName","genCssVariables","map","startsWith","undefined","rgb","r","g","b","bgLines","fgLines","Set","values","flatMap","push","str","i","join","addHeadObjs","style","children","type","id","cspNonce","nonce","updateDOM","styleEl","document","getElementById","updateStyles","immediate","el","createElement","setAttribute","appendChild","innerHTML","themeClasses","global","provideTheme","props","Error","newTheme","useTheme","selector","content","line","lightOverlay","darkOverlay"],"sources":["../../src/composables/theme.ts"],"sourcesContent":["// Utilities\nimport {\n computed,\n inject,\n provide,\n reactive,\n ref,\n watch,\n watchEffect,\n} from 'vue'\nimport {\n colorToInt,\n colorToRGB,\n createRange,\n darken,\n getCurrentInstance,\n getLuma,\n IN_BROWSER,\n intToHex,\n lighten,\n mergeDeep,\n propsFactory,\n} from '@/util'\nimport { APCAcontrast } from '@/util/color/APCA'\n\n// Types\nimport type { App, DeepReadonly, InjectionKey, Ref } from 'vue'\nimport type { HeadAttrs, HeadClient } from '@vueuse/head'\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\nconst defaultThemeOptions: Exclude<ThemeOptions, false> = {\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-variant': '#424242',\n 'on-surface-variant': '#EEEEEE',\n primary: '#6200EE',\n 'primary-darken-1': '#3700B3',\n secondary: '#03DAC6',\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 'kbd-background-color': '#212529',\n 'kbd-color': '#FFFFFF',\n 'code-background-color': '#C2C2C2',\n },\n },\n dark: {\n dark: true,\n colors: {\n background: '#121212',\n surface: '#212121',\n 'surface-variant': '#BDBDBD',\n 'on-surface-variant': '#424242',\n primary: '#BB86FC',\n 'primary-darken-1': '#3700B3',\n secondary: '#03DAC5',\n 'secondary-darken-1': '#03DAC5',\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': 0.87,\n 'medium-emphasis-opacity': 0.60,\n 'disabled-opacity': 0.38,\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 'kbd-background-color': '#212529',\n 'kbd-color': '#FFFFFF',\n 'code-background-color': '#B7B7B7',\n },\n },\n },\n}\n\nfunction parseThemeOptions (options: ThemeOptions = defaultThemeOptions): InternalThemeOptions {\n if (!options) return { ...defaultThemeOptions, isDisabled: true } as InternalThemeOptions\n\n const themes: Record<string, InternalThemeDefinition> = {}\n for (const [key, theme] of Object.entries(options.themes ?? {})) {\n const defaultTheme = theme.dark\n ? defaultThemeOptions.themes?.dark\n : defaultThemeOptions.themes?.light\n themes[key] = mergeDeep(defaultTheme, theme) as InternalThemeDefinition\n }\n\n return mergeDeep(\n defaultThemeOptions,\n { ...options, themes },\n ) as InternalThemeOptions\n}\n\n// Composables\nexport function createTheme (app: App, options?: ThemeOptions): ThemeInstance {\n const head = app._context.provides.usehead as HeadClient | undefined\n const parsedOptions = reactive(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 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}`] = intToHex(fn(colorToInt(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 = colorToInt(theme.colors[color]!)\n\n const blackContrast = Math.abs(APCAcontrast(0, colorVal))\n const whiteContrast = Math.abs(APCAcontrast(0xffffff, colorVal))\n\n // TODO: warn about poor color selections\n // const contrastAsText = Math.abs(APCAcontrast(colorVal, colorToInt(theme.colors.background)))\n // const minContrast = Math.max(blackContrast, whiteContrast)\n // if (minContrast < 60) {\n // consoleInfo(`${key} theme color ${color} has poor contrast (${minContrast.toFixed()}%)`)\n // } else if (contrastAsText < 60 && !['background', 'surface'].includes(color)) {\n // consoleInfo(`${key} theme color ${color} has poor contrast as text (${contrastAsText.toFixed()}%)`)\n // }\n\n // Prefer white text if both have an acceptable contrast ratio\n theme.colors[onColor] = whiteContrast > Math.min(blackContrast, 50) ? '#fff' : '#000'\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 for (const [themeName, theme] of Object.entries(computedThemes.value)) {\n const { variables, dark } = theme\n\n createCssClass(lines, `.v-theme--${themeName}`, [\n `color-scheme: ${dark ? 'dark' : 'normal'}`,\n ...genCssVariables(theme),\n ...Object.keys(variables).map(key => {\n const value = variables[key]\n const color = typeof value === 'string' && value.startsWith('#') ? colorToRGB(value) : undefined\n const rgb = color ? `${color.r}, ${color.g}, ${color.b}` : undefined\n\n return `--v-${key}: ${rgb ?? value}`\n }),\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: 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 if (head) {\n head.addHeadObjs(computed(() => {\n const style: HeadAttrs = {\n children: styles.value,\n type: 'text/css',\n id: 'vuetify-theme-stylesheet',\n }\n if (parsedOptions.cspNonce) style.nonce = parsedOptions.cspNonce\n\n return { style: [style] }\n }))\n\n if (IN_BROWSER) {\n watchEffect(() => head.updateDOM())\n }\n } else {\n let styleEl = IN_BROWSER\n ? document.getElementById('vuetify-theme-stylesheet')\n : null\n\n watch(styles, updateStyles, { immediate: true })\n function updateStyles () {\n if (parsedOptions.isDisabled) return\n\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 const themeClasses = computed(() => parsedOptions.isDisabled ? undefined : `v-theme--${name.value}`)\n\n return {\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\n const themeClasses = computed(() => theme.isDisabled ? undefined : `v-theme--${name.value}`)\n\n const newTheme: ThemeInstance = {\n ...theme,\n name,\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 = colorToRGB(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 return variables\n}\n"],"mappings":"AAAA;AACA,SACEA,QADF,EAEEC,MAFF,EAGEC,OAHF,EAIEC,QAJF,EAKEC,GALF,EAMEC,KANF,EAOEC,WAPF,QAQO,KARP;SAUEC,U,EACAC,U,EACAC,W,EACAC,M,EACAC,kB,EACAC,O,EACAC,U,EACAC,Q,EACAC,O,EACAC,S,EACAC,Y;SAEOC,Y,kCAET;;AA6EA,OAAO,MAAMC,WAAwC,GAAGC,MAAM,CAACC,GAAP,CAAW,eAAX,CAAjD;AAEP,OAAO,MAAMC,cAAc,GAAGL,YAAY,CAAC;EACzCM,KAAK,EAAEC;AADkC,CAAD,EAEvC,OAFuC,CAAnC;AAIP,MAAMC,mBAAiD,GAAG;EACxDC,YAAY,EAAE,OAD0C;EAExDC,UAAU,EAAE;IAAEC,MAAM,EAAE,EAAV;IAAcb,OAAO,EAAE,CAAvB;IAA0BL,MAAM,EAAE;EAAlC,CAF4C;EAGxDmB,MAAM,EAAE;IACNC,KAAK,EAAE;MACLC,IAAI,EAAE,KADD;MAELH,MAAM,EAAE;QACNI,UAAU,EAAE,SADN;QAENC,OAAO,EAAE,SAFH;QAGN,mBAAmB,SAHb;QAIN,sBAAsB,SAJhB;QAKNC,OAAO,EAAE,SALH;QAMN,oBAAoB,SANd;QAONC,SAA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","reactive","ref","watch","watchEffect","colorToInt","colorToRGB","createRange","darken","getCurrentInstance","getLuma","IN_BROWSER","intToHex","lighten","mergeDeep","propsFactory","APCAcontrast","ThemeSymbol","Symbol","for","makeThemeProps","theme","String","defaultThemeOptions","defaultTheme","variations","colors","themes","light","dark","background","surface","primary","secondary","error","info","success","warning","variables","parseThemeOptions","options","isDisabled","key","Object","entries","createTheme","parsedOptions","name","computedThemes","acc","original","value","color","variation","fn","amount","keys","test","onColor","colorVal","blackContrast","Math","abs","whiteContrast","min","current","styles","lines","createCssClass","themeName","genCssVariables","map","startsWith","undefined","rgb","r","g","b","bgLines","fgLines","Set","values","flatMap","push","str","i","join","install","app","head","_context","provides","usehead","addHeadObjs","style","children","type","id","cspNonce","nonce","updateDOM","styleEl","document","getElementById","updateStyles","immediate","el","createElement","setAttribute","appendChild","innerHTML","themeClasses","global","provideTheme","props","Error","newTheme","useTheme","selector","content","line","lightOverlay","darkOverlay"],"sources":["../../src/composables/theme.ts"],"sourcesContent":["// Utilities\nimport {\n computed,\n inject,\n provide,\n reactive,\n ref,\n watch,\n watchEffect,\n} from 'vue'\nimport {\n colorToInt,\n colorToRGB,\n createRange,\n darken,\n getCurrentInstance,\n getLuma,\n IN_BROWSER,\n intToHex,\n lighten,\n mergeDeep,\n propsFactory,\n} from '@/util'\nimport { APCAcontrast } from '@/util/color/APCA'\n\n// Types\nimport type { App, DeepReadonly, InjectionKey, Ref } from 'vue'\nimport type { HeadAttrs, HeadClient } from '@vueuse/head'\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\nconst defaultThemeOptions: Exclude<ThemeOptions, false> = {\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-variant': '#424242',\n 'on-surface-variant': '#EEEEEE',\n primary: '#6200EE',\n 'primary-darken-1': '#3700B3',\n secondary: '#03DAC6',\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-variant': '#BDBDBD',\n 'on-surface-variant': '#424242',\n primary: '#BB86FC',\n 'primary-darken-1': '#3700B3',\n secondary: '#03DAC5',\n 'secondary-darken-1': '#03DAC5',\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': 0.87,\n 'medium-emphasis-opacity': 0.60,\n 'disabled-opacity': 0.38,\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\nfunction parseThemeOptions (options: ThemeOptions = defaultThemeOptions): InternalThemeOptions {\n if (!options) return { ...defaultThemeOptions, isDisabled: true } as InternalThemeOptions\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 ? defaultThemeOptions.themes?.dark\n : defaultThemeOptions.themes?.light\n themes[key] = mergeDeep(defaultTheme, theme) as InternalThemeDefinition\n }\n\n return mergeDeep(\n defaultThemeOptions,\n { ...options, themes },\n ) as InternalThemeOptions\n}\n\n// Composables\nexport function createTheme (options?: ThemeOptions): ThemeInstance & { install: (app: App) => void } {\n const parsedOptions = reactive(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}`] = intToHex(fn(colorToInt(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 = colorToInt(theme.colors[color]!)\n\n const blackContrast = Math.abs(APCAcontrast(0, colorVal))\n const whiteContrast = Math.abs(APCAcontrast(0xffffff, colorVal))\n\n // TODO: warn about poor color selections\n // const contrastAsText = Math.abs(APCAcontrast(colorVal, colorToInt(theme.colors.background)))\n // const minContrast = Math.max(blackContrast, whiteContrast)\n // if (minContrast < 60) {\n // consoleInfo(`${key} theme color ${color} has poor contrast (${minContrast.toFixed()}%)`)\n // } else if (contrastAsText < 60 && !['background', 'surface'].includes(color)) {\n // consoleInfo(`${key} theme color ${color} has poor contrast as text (${contrastAsText.toFixed()}%)`)\n // }\n\n // Prefer white text if both have an acceptable contrast ratio\n theme.colors[onColor] = whiteContrast > Math.min(blackContrast, 50) ? '#fff' : '#000'\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 for (const [themeName, theme] of Object.entries(computedThemes.value)) {\n const { variables, dark } = theme\n\n createCssClass(lines, `.v-theme--${themeName}`, [\n `color-scheme: ${dark ? 'dark' : 'normal'}`,\n ...genCssVariables(theme),\n ...Object.keys(variables).map(key => {\n const value = variables[key]\n const color = typeof value === 'string' && value.startsWith('#') ? colorToRGB(value) : undefined\n const rgb = color ? `${color.r}, ${color.g}, ${color.b}` : undefined\n\n return `--v-${key}: ${rgb ?? value}`\n }),\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: 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 install (app: App) {\n const head = app._context.provides.usehead as HeadClient | undefined\n if (head) {\n head.addHeadObjs(computed(() => {\n const style: HeadAttrs = {\n children: styles.value,\n type: 'text/css',\n id: 'vuetify-theme-stylesheet',\n }\n if (parsedOptions.cspNonce) style.nonce = parsedOptions.cspNonce\n\n return { style: [style] }\n }))\n\n if (IN_BROWSER) {\n watchEffect(() => head.updateDOM())\n }\n } else {\n let styleEl = IN_BROWSER\n ? document.getElementById('vuetify-theme-stylesheet')\n : null\n\n watch(styles, updateStyles, { immediate: true })\n\n function updateStyles () {\n if (parsedOptions.isDisabled) return\n\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\n const themeClasses = computed(() => theme.isDisabled ? undefined : `v-theme--${name.value}`)\n\n const newTheme: ThemeInstance = {\n ...theme,\n name,\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 = colorToRGB(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 return variables\n}\n"],"mappings":"AAAA;AACA,SACEA,QAAQ,EACRC,MAAM,EACNC,OAAO,EACPC,QAAQ,EACRC,GAAG,EACHC,KAAK,EACLC,WAAW,QACN,KAAK;AAAA,SAEVC,UAAU,EACVC,UAAU,EACVC,WAAW,EACXC,MAAM,EACNC,kBAAkB,EAClBC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AAEjD,KAA8B,EAAE;EACxD,MAAMoG,YAAY,GAAGpG,KAAK,CAACQ,IAAI,GAAG,CAAC,GAAG,CAAC;EACvC,MAAM6F,WAAW,GAAGrG,KAAK,CAACQ,IAAI,GAAG,CAAC,GAAG,CAAC;EAEtC,MAAMS,SAAmB,GAAG,EAAE;EAC9B,KAAK,MAAM,CAACI,GAAG,EAAES,KAAK,CAAC,IAAIR,MAAM,CAACC,OAAO,CAACvB,KAAK,CAACK,MAAM,CAAC,EAAE;IACvD,MAAMgD,GAAG,GAAGpE,UAAU,CAAC6C,KAAK,CAAC;IAC7Bb,SAAS,CAAC6C,IAAI,CAAE,aAAYzC,GAAI,KAAIgC,GAAG,CAACC,CAAE,IAAGD,GAAG,CAACE,CAAE,IAAGF,GAAG,CAACG,CAAE,EAAC,CAAC;IAC9D,IAAI,CAACnC,GAAG,CAAC8B,UAAU,CAAC,KAAK,CAAC,EAAE;MAC1BlC,SAAS,CAAC6C,IAAI,CAAE,aAAYzC,GAAI,wBAAuBhC,OAAO,CAACyC,KAAK,CAAC,GAAG,IAAI,GAAGsE,YAAY,GAAGC,WAAY,EAAC,CAAC;IAC9G;EACF;EAEA,OAAOpF,SAAS;AAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggleScope.mjs","names":["effectScope","watch","useToggleScope","source","cb","scope","active","run","stop","undefined","immediate"],"sources":["../../src/composables/toggleScope.ts"],"sourcesContent":["import { effectScope, watch } from 'vue'\nimport type { EffectScope, WatchSource } from 'vue'\n\nexport function useToggleScope (source: WatchSource<boolean>, cb: () => void) {\n let scope: EffectScope | undefined\n watch(source, active => {\n if (active && !scope) {\n scope = effectScope()\n scope.run(cb)\n } else {\n scope?.stop()\n scope = undefined\n }\n }, { immediate: true })\n}\n"],"mappings":"AAAA,SAASA,
|
|
1
|
+
{"version":3,"file":"toggleScope.mjs","names":["effectScope","watch","useToggleScope","source","cb","scope","active","run","stop","undefined","immediate"],"sources":["../../src/composables/toggleScope.ts"],"sourcesContent":["import { effectScope, watch } from 'vue'\nimport type { EffectScope, WatchSource } from 'vue'\n\nexport function useToggleScope (source: WatchSource<boolean>, cb: () => void) {\n let scope: EffectScope | undefined\n watch(source, active => {\n if (active && !scope) {\n scope = effectScope()\n scope.run(cb)\n } else {\n scope?.stop()\n scope = undefined\n }\n }, { immediate: true })\n}\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,KAAK,QAAQ,KAAK;AAGxC,OAAO,SAASC,cAAc,CAAEC,MAA4B,EAAEC,EAAc,EAAE;EAC5E,IAAIC,KAA8B;EAClCJ,KAAK,CAACE,MAAM,EAAEG,MAAM,IAAI;IACtB,IAAIA,MAAM,IAAI,CAACD,KAAK,EAAE;MACpBA,KAAK,GAAGL,WAAW,EAAE;MACrBK,KAAK,CAACE,GAAG,CAACH,EAAE,CAAC;IACf,CAAC,MAAM;MAAA;MACL,UAAAC,KAAK,qBAAL,OAAOG,IAAI,EAAE;MACbH,KAAK,GAAGI,SAAS;IACnB;EACF,CAAC,EAAE;IAAEC,SAAS,EAAE;EAAK,CAAC,CAAC;AACzB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CircularBuffer } from "../util/index.mjs";
|
|
2
2
|
const HORIZON = 100; // ms
|
|
3
|
-
|
|
4
3
|
const HISTORY = 20; // number of samples to keep
|
|
5
4
|
|
|
6
5
|
/** @see https://android.googlesource.com/platform/frameworks/native/+/master/libs/input/VelocityTracker.cpp */
|
|
@@ -8,86 +7,67 @@ function kineticEnergyToVelocity(work) {
|
|
|
8
7
|
const sqrt2 = 1.41421356237;
|
|
9
8
|
return (work < 0 ? -1.0 : 1.0) * Math.sqrt(Math.abs(work)) * sqrt2;
|
|
10
9
|
}
|
|
10
|
+
|
|
11
11
|
/**
|
|
12
12
|
* Returns pointer velocity in px/s
|
|
13
13
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
14
|
export function calculateImpulseVelocity(samples) {
|
|
17
15
|
// The input should be in reversed time order (most recent sample at index i=0)
|
|
18
16
|
if (samples.length < 2) {
|
|
19
17
|
// if 0 or 1 points, velocity is zero
|
|
20
18
|
return 0;
|
|
21
|
-
}
|
|
19
|
+
}
|
|
20
|
+
// if (samples[1].t > samples[0].t) {
|
|
22
21
|
// // Algorithm will still work, but not perfectly
|
|
23
22
|
// consoleWarn('Samples provided to calculateImpulseVelocity in the wrong order')
|
|
24
23
|
// }
|
|
25
|
-
|
|
26
|
-
|
|
27
24
|
if (samples.length === 2) {
|
|
28
25
|
// if 2 points, basic linear calculation
|
|
29
26
|
if (samples[1].t === samples[0].t) {
|
|
30
27
|
// consoleWarn(`Events have identical time stamps t=${samples[0].t}, setting velocity = 0`)
|
|
31
28
|
return 0;
|
|
32
29
|
}
|
|
33
|
-
|
|
34
30
|
return (samples[1].d - samples[0].d) / (samples[1].t - samples[0].t);
|
|
35
|
-
}
|
|
31
|
+
}
|
|
32
|
+
// Guaranteed to have at least 3 points here
|
|
36
33
|
// start with the oldest sample and go forward in time
|
|
37
|
-
|
|
38
|
-
|
|
39
34
|
let work = 0;
|
|
40
|
-
|
|
41
35
|
for (let i = samples.length - 1; i > 0; i--) {
|
|
42
36
|
if (samples[i].t === samples[i - 1].t) {
|
|
43
37
|
// consoleWarn(`Events have identical time stamps t=${samples[i].t}, skipping sample`)
|
|
44
38
|
continue;
|
|
45
39
|
}
|
|
46
|
-
|
|
47
40
|
const vprev = kineticEnergyToVelocity(work); // v[i-1]
|
|
48
|
-
|
|
49
41
|
const vcurr = (samples[i].d - samples[i - 1].d) / (samples[i].t - samples[i - 1].t); // v[i]
|
|
50
|
-
|
|
51
42
|
work += (vcurr - vprev) * Math.abs(vcurr);
|
|
52
|
-
|
|
53
43
|
if (i === samples.length - 1) {
|
|
54
44
|
work *= 0.5;
|
|
55
45
|
}
|
|
56
46
|
}
|
|
57
|
-
|
|
58
47
|
return kineticEnergyToVelocity(work) * 1000;
|
|
59
48
|
}
|
|
60
49
|
export function useVelocity() {
|
|
61
50
|
const touches = {};
|
|
62
|
-
|
|
63
51
|
function addMovement(e) {
|
|
64
52
|
Array.from(e.changedTouches).forEach(touch => {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const samples = (_touches$touch$identi = touches[touch.identifier]) != null ? _touches$touch$identi : touches[touch.identifier] = new CircularBuffer(HISTORY);
|
|
53
|
+
const samples = touches[touch.identifier] ?? (touches[touch.identifier] = new CircularBuffer(HISTORY));
|
|
68
54
|
samples.push([e.timeStamp, touch]);
|
|
69
55
|
});
|
|
70
56
|
}
|
|
71
|
-
|
|
72
57
|
function endTouch(e) {
|
|
73
58
|
Array.from(e.changedTouches).forEach(touch => {
|
|
74
59
|
delete touches[touch.identifier];
|
|
75
60
|
});
|
|
76
61
|
}
|
|
77
|
-
|
|
78
62
|
function getVelocity(id) {
|
|
79
63
|
var _touches$id;
|
|
80
|
-
|
|
81
64
|
const samples = (_touches$id = touches[id]) == null ? void 0 : _touches$id.values().reverse();
|
|
82
|
-
|
|
83
65
|
if (!samples) {
|
|
84
66
|
throw new Error(`No samples for touch id ${id}`);
|
|
85
67
|
}
|
|
86
|
-
|
|
87
68
|
const newest = samples[0];
|
|
88
69
|
const x = [];
|
|
89
70
|
const y = [];
|
|
90
|
-
|
|
91
71
|
for (const val of samples) {
|
|
92
72
|
if (newest[0] - val[0] > HORIZON) break;
|
|
93
73
|
x.push({
|
|
@@ -99,11 +79,9 @@ export function useVelocity() {
|
|
|
99
79
|
d: val[1].clientY
|
|
100
80
|
});
|
|
101
81
|
}
|
|
102
|
-
|
|
103
82
|
return {
|
|
104
83
|
x: calculateImpulseVelocity(x),
|
|
105
84
|
y: calculateImpulseVelocity(y),
|
|
106
|
-
|
|
107
85
|
get direction() {
|
|
108
86
|
const {
|
|
109
87
|
x,
|
|
@@ -112,17 +90,14 @@ export function useVelocity() {
|
|
|
112
90
|
const [absX, absY] = [Math.abs(x), Math.abs(y)];
|
|
113
91
|
return absX > absY && x >= 0 ? 'right' : absX > absY && x <= 0 ? 'left' : absY > absX && y >= 0 ? 'down' : absY > absX && y <= 0 ? 'up' : oops();
|
|
114
92
|
}
|
|
115
|
-
|
|
116
93
|
};
|
|
117
94
|
}
|
|
118
|
-
|
|
119
95
|
return {
|
|
120
96
|
addMovement,
|
|
121
97
|
endTouch,
|
|
122
98
|
getVelocity
|
|
123
99
|
};
|
|
124
100
|
}
|
|
125
|
-
|
|
126
101
|
function oops() {
|
|
127
102
|
throw new Error();
|
|
128
103
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"touch.mjs","names":["CircularBuffer","HORIZON","HISTORY","kineticEnergyToVelocity","work","sqrt2","Math","sqrt","abs","calculateImpulseVelocity","samples","length","t","d","i","vprev","vcurr","useVelocity","touches","addMovement","e","Array","from","changedTouches","forEach","touch","identifier","push","timeStamp","endTouch","getVelocity","id","values","reverse","Error","newest","x","y","val","clientX","clientY","direction","absX","absY","oops"],"sources":["../../src/composables/touch.ts"],"sourcesContent":["import { CircularBuffer } from '@/util'\n\nconst HORIZON = 100 // ms\nconst HISTORY = 20 // number of samples to keep\n\nexport interface Sample {\n t: number\n d: number\n}\n\n/** @see https://android.googlesource.com/platform/frameworks/native/+/master/libs/input/VelocityTracker.cpp */\nfunction kineticEnergyToVelocity (work: number) {\n const sqrt2 = 1.41421356237\n return (work < 0 ? -1.0 : 1.0) * Math.sqrt(Math.abs(work)) * sqrt2\n}\n\n/**\n * Returns pointer velocity in px/s\n */\nexport function calculateImpulseVelocity (samples: Sample[]) {\n // The input should be in reversed time order (most recent sample at index i=0)\n if (samples.length < 2) {\n // if 0 or 1 points, velocity is zero\n return 0\n }\n // if (samples[1].t > samples[0].t) {\n // // Algorithm will still work, but not perfectly\n // consoleWarn('Samples provided to calculateImpulseVelocity in the wrong order')\n // }\n if (samples.length === 2) {\n // if 2 points, basic linear calculation\n if (samples[1].t === samples[0].t) {\n // consoleWarn(`Events have identical time stamps t=${samples[0].t}, setting velocity = 0`)\n return 0\n }\n return (samples[1].d - samples[0].d) / (samples[1].t - samples[0].t)\n }\n // Guaranteed to have at least 3 points here\n // start with the oldest sample and go forward in time\n let work = 0\n for (let i = samples.length - 1; i > 0; i--) {\n if (samples[i].t === samples[i - 1].t) {\n // consoleWarn(`Events have identical time stamps t=${samples[i].t}, skipping sample`)\n continue\n }\n const vprev = kineticEnergyToVelocity(work) // v[i-1]\n const vcurr = (samples[i].d - samples[i - 1].d) / (samples[i].t - samples[i - 1].t) // v[i]\n work += (vcurr - vprev) * Math.abs(vcurr)\n if (i === samples.length - 1) {\n work *= 0.5\n }\n }\n return kineticEnergyToVelocity(work) * 1000\n}\n\nexport function useVelocity () {\n const touches: Record<number, CircularBuffer<[number, Touch]> | undefined> = {}\n\n function addMovement (e: TouchEvent) {\n Array.from(e.changedTouches).forEach(touch => {\n const samples = touches[touch.identifier] ?? (touches[touch.identifier] = new CircularBuffer(HISTORY))\n samples.push([e.timeStamp, touch])\n })\n }\n\n function endTouch (e: TouchEvent) {\n Array.from(e.changedTouches).forEach(touch => {\n delete touches[touch.identifier]\n })\n }\n\n function getVelocity (id: number) {\n const samples = touches[id]?.values().reverse()\n\n if (!samples) {\n throw new Error(`No samples for touch id ${id}`)\n }\n\n const newest = samples[0]\n const x: Sample[] = []\n const y: Sample[] = []\n for (const val of samples) {\n if (newest[0] - val[0] > HORIZON) break\n\n x.push({ t: val[0], d: val[1].clientX })\n y.push({ t: val[0], d: val[1].clientY })\n }\n\n return {\n x: calculateImpulseVelocity(x),\n y: calculateImpulseVelocity(y),\n get direction () {\n const { x, y } = this\n const [absX, absY] = [Math.abs(x), Math.abs(y)]\n\n return absX > absY && x >= 0 ? 'right'\n : absX > absY && x <= 0 ? 'left'\n : absY > absX && y >= 0 ? 'down'\n : absY > absX && y <= 0 ? 'up'\n : oops()\n },\n }\n }\n\n return { addMovement, endTouch, getVelocity }\n}\n\nfunction oops (): never {\n throw new Error()\n}\n"],"mappings":"SAASA,
|
|
1
|
+
{"version":3,"file":"touch.mjs","names":["CircularBuffer","HORIZON","HISTORY","kineticEnergyToVelocity","work","sqrt2","Math","sqrt","abs","calculateImpulseVelocity","samples","length","t","d","i","vprev","vcurr","useVelocity","touches","addMovement","e","Array","from","changedTouches","forEach","touch","identifier","push","timeStamp","endTouch","getVelocity","id","values","reverse","Error","newest","x","y","val","clientX","clientY","direction","absX","absY","oops"],"sources":["../../src/composables/touch.ts"],"sourcesContent":["import { CircularBuffer } from '@/util'\n\nconst HORIZON = 100 // ms\nconst HISTORY = 20 // number of samples to keep\n\nexport interface Sample {\n t: number\n d: number\n}\n\n/** @see https://android.googlesource.com/platform/frameworks/native/+/master/libs/input/VelocityTracker.cpp */\nfunction kineticEnergyToVelocity (work: number) {\n const sqrt2 = 1.41421356237\n return (work < 0 ? -1.0 : 1.0) * Math.sqrt(Math.abs(work)) * sqrt2\n}\n\n/**\n * Returns pointer velocity in px/s\n */\nexport function calculateImpulseVelocity (samples: Sample[]) {\n // The input should be in reversed time order (most recent sample at index i=0)\n if (samples.length < 2) {\n // if 0 or 1 points, velocity is zero\n return 0\n }\n // if (samples[1].t > samples[0].t) {\n // // Algorithm will still work, but not perfectly\n // consoleWarn('Samples provided to calculateImpulseVelocity in the wrong order')\n // }\n if (samples.length === 2) {\n // if 2 points, basic linear calculation\n if (samples[1].t === samples[0].t) {\n // consoleWarn(`Events have identical time stamps t=${samples[0].t}, setting velocity = 0`)\n return 0\n }\n return (samples[1].d - samples[0].d) / (samples[1].t - samples[0].t)\n }\n // Guaranteed to have at least 3 points here\n // start with the oldest sample and go forward in time\n let work = 0\n for (let i = samples.length - 1; i > 0; i--) {\n if (samples[i].t === samples[i - 1].t) {\n // consoleWarn(`Events have identical time stamps t=${samples[i].t}, skipping sample`)\n continue\n }\n const vprev = kineticEnergyToVelocity(work) // v[i-1]\n const vcurr = (samples[i].d - samples[i - 1].d) / (samples[i].t - samples[i - 1].t) // v[i]\n work += (vcurr - vprev) * Math.abs(vcurr)\n if (i === samples.length - 1) {\n work *= 0.5\n }\n }\n return kineticEnergyToVelocity(work) * 1000\n}\n\nexport function useVelocity () {\n const touches: Record<number, CircularBuffer<[number, Touch]> | undefined> = {}\n\n function addMovement (e: TouchEvent) {\n Array.from(e.changedTouches).forEach(touch => {\n const samples = touches[touch.identifier] ?? (touches[touch.identifier] = new CircularBuffer(HISTORY))\n samples.push([e.timeStamp, touch])\n })\n }\n\n function endTouch (e: TouchEvent) {\n Array.from(e.changedTouches).forEach(touch => {\n delete touches[touch.identifier]\n })\n }\n\n function getVelocity (id: number) {\n const samples = touches[id]?.values().reverse()\n\n if (!samples) {\n throw new Error(`No samples for touch id ${id}`)\n }\n\n const newest = samples[0]\n const x: Sample[] = []\n const y: Sample[] = []\n for (const val of samples) {\n if (newest[0] - val[0] > HORIZON) break\n\n x.push({ t: val[0], d: val[1].clientX })\n y.push({ t: val[0], d: val[1].clientY })\n }\n\n return {\n x: calculateImpulseVelocity(x),\n y: calculateImpulseVelocity(y),\n get direction () {\n const { x, y } = this\n const [absX, absY] = [Math.abs(x), Math.abs(y)]\n\n return absX > absY && x >= 0 ? 'right'\n : absX > absY && x <= 0 ? 'left'\n : absY > absX && y >= 0 ? 'down'\n : absY > absX && y <= 0 ? 'up'\n : oops()\n },\n }\n }\n\n return { addMovement, endTouch, getVelocity }\n}\n\nfunction oops (): never {\n throw new Error()\n}\n"],"mappings":"SAASA,cAAc;AAEvB,MAAMC,OAAO,GAAG,GAAG,EAAC;AACpB,MAAMC,OAAO,GAAG,EAAE,EAAC;;AAOnB;AACA,SAASC,uBAAuB,CAAEC,IAAY,EAAE;EAC9C,MAAMC,KAAK,GAAG,aAAa;EAC3B,OAAO,CAACD,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,IAAIE,IAAI,CAACC,IAAI,CAACD,IAAI,CAACE,GAAG,CAACJ,IAAI,CAAC,CAAC,GAAGC,KAAK;AACpE;;AAEA;AACA;AACA;AACA,OAAO,SAASI,wBAAwB,CAAEC,OAAiB,EAAE;EAC3D;EACA,IAAIA,OAAO,CAAC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B,GAAG,CAAC,CAAC,CAAC;QAAEzB,CAAC,EAAEyB,GAAG,CAAC,CAAC,CAAC,CAACC;MAAQ,CAAC,CAAC;MACxCF,CAAC,CAACV,IAAI,CAAC;QAAEf,CAAC,EAAE0B,GAAG,CAAC,CAAC,CAAC;QAAEzB,CAAC,EAAEyB,GAAG,CAAC,CAAC,CAAC,CAACE;MAAQ,CAAC,CAAC;IAC1C;IAEA,OAAO;MACLJ,CAAC,EAAE3B,wBAAwB,CAAC2B,CAAC,CAAC;MAC9BC,CAAC,EAAE5B,wBAAwB,CAAC4B,CAAC,CAAC;MAC9B,IAAII,SAAS,GAAI;QACf,MAAM;UAAEL,CAAC;UAAEC;QAAE,CAAC,GAAG,IAAI;QACrB,MAAM,CAACK,IAAI,EAAEC,IAAI,CAAC,GAAG,CAACrC,IAAI,CAACE,GAAG,CAAC4B,CAAC,CAAC,EAAE9B,IAAI,CAACE,GAAG,CAAC6B,CAAC,CAAC,CAAC;QAE/C,OAAOK,IAAI,GAAGC,IAAI,IAAIP,CAAC,IAAI,CAAC,GAAG,OAAO,GAClCM,IAAI,GAAGC,IAAI,IAAIP,CAAC,IAAI,CAAC,GAAG,MAAM,GAC9BO,IAAI,GAAGD,IAAI,IAAIL,CAAC,IAAI,CAAC,GAAG,MAAM,GAC9BM,IAAI,GAAGD,IAAI,IAAIL,CAAC,IAAI,CAAC,GAAG,IAAI,GAC5BO,IAAI,EAAE;MACZ;IACF,CAAC;EACH;EAEA,OAAO;IAAEzB,WAAW;IAAEU,QAAQ;IAAEC;EAAY,CAAC;AAC/C;AAEA,SAASc,IAAI,GAAW;EACtB,MAAM,IAAIV,KAAK,EAAE;AACnB"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Utilities
|
|
2
2
|
import { h, mergeProps, Transition } from 'vue';
|
|
3
3
|
import { propsFactory } from "../util/index.mjs"; // Types
|
|
4
|
-
|
|
5
4
|
export const makeTransitionProps = propsFactory({
|
|
6
5
|
transition: {
|
|
7
6
|
type: [Boolean, String, Object],
|
|
@@ -10,8 +9,6 @@ export const makeTransitionProps = propsFactory({
|
|
|
10
9
|
}
|
|
11
10
|
}, 'transition');
|
|
12
11
|
export const MaybeTransition = (props, _ref) => {
|
|
13
|
-
var _slots$default;
|
|
14
|
-
|
|
15
12
|
let {
|
|
16
13
|
slots
|
|
17
14
|
} = _ref;
|
|
@@ -19,7 +16,6 @@ export const MaybeTransition = (props, _ref) => {
|
|
|
19
16
|
transition,
|
|
20
17
|
...rest
|
|
21
18
|
} = props;
|
|
22
|
-
if (!transition || typeof transition === 'boolean') return (_slots$default = slots.default) == null ? void 0 : _slots$default.call(slots);
|
|
23
19
|
const {
|
|
24
20
|
component = Transition,
|
|
25
21
|
...customProps
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transition.mjs","names":["h","mergeProps","Transition","propsFactory","makeTransitionProps","transition","type","Boolean","String","Object","default","validator","val","MaybeTransition","props","slots","rest","component","customProps","name"],"sources":["../../src/composables/transition.ts"],"sourcesContent":["// Utilities\nimport { h, mergeProps, Transition } from 'vue'\nimport { propsFactory } from '@/util'\n\n// Types\nimport type { Component, FunctionalComponent, PropType, TransitionProps } from 'vue'\n\nexport const makeTransitionProps = propsFactory({\n transition: {\n type: [Boolean, String, Object] as PropType<string | boolean | TransitionProps & { component?: Component }>,\n default: 'fade-transition',\n validator: val => val !== true,\n },\n}, 'transition')\n\ninterface MaybeTransitionProps extends TransitionProps {\n transition?: string | boolean | TransitionProps & { component?: any }\n}\n\nexport const MaybeTransition: FunctionalComponent<MaybeTransitionProps> = (props, { slots }) => {\n const { transition, ...rest } = props\n\n
|
|
1
|
+
{"version":3,"file":"transition.mjs","names":["h","mergeProps","Transition","propsFactory","makeTransitionProps","transition","type","Boolean","String","Object","default","validator","val","MaybeTransition","props","slots","rest","component","customProps","name"],"sources":["../../src/composables/transition.ts"],"sourcesContent":["// Utilities\nimport { h, mergeProps, Transition } from 'vue'\nimport { propsFactory } from '@/util'\n\n// Types\nimport type { Component, FunctionalComponent, PropType, TransitionProps } from 'vue'\n\nexport const makeTransitionProps = propsFactory({\n transition: {\n type: [Boolean, String, Object] as PropType<string | boolean | TransitionProps & { component?: Component }>,\n default: 'fade-transition',\n validator: val => val !== true,\n },\n}, 'transition')\n\ninterface MaybeTransitionProps extends TransitionProps {\n transition?: string | boolean | TransitionProps & { component?: any }\n}\n\nexport const MaybeTransition: FunctionalComponent<MaybeTransitionProps> = (props, { slots }) => {\n const { transition, ...rest } = props\n\n const { component = Transition, ...customProps } = typeof transition === 'object' ? transition : {}\n\n return h(\n component,\n mergeProps(typeof transition === 'string' ? { name: transition } : customProps as any, rest as any),\n slots\n )\n}\n"],"mappings":"AAAA;AACA,SAASA,CAAC,EAAEC,UAAU,EAAEC,UAAU,QAAQ,KAAK;AAAA,SACtCC,YAAY,6BAErB;AAGA,OAAO,MAAMC,mBAAmB,GAAGD,YAAY,CAAC;EAC9CE,UAAU,EAAE;IACVC,IAAI,EAAE,CAACC,OAAO,EAAEC,MAAM,EAAEC,MAAM,CAA6E;IAC3GC,OAAO,EAAE,iBAAiB;IAC1BC,SAAS,EAAEC,GAAG,IAAIA,GAAG,KAAK;EAC5B;AACF,CAAC,EAAE,YAAY,CAAC;AAMhB,OAAO,MAAMC,eAA0D,GAAG,CAACC,KAAK,WAAgB;EAAA,IAAd;IAAEC;EAAM,CAAC;EACzF,MAAM;IAAEV,UAAU;IAAE,GAAGW;EAAK,CAAC,GAAGF,KAAK;EAErC,MAAM;IAAEG,SAAS,GAAGf,UAAU;IAAE,GAAGgB;EAAY,CAAC,GAAG,OAAOb,UAAU,KAAK,QAAQ,GAAGA,UAAU,GAAG,CAAC,CAAC;EAEnG,OAAOL,CAAC,CACNiB,SAAS,EACThB,UAAU,CAAC,OAAOI,UAAU,KAAK,QAAQ,GAAG;IAAEc,IAAI,EAAEd;EAAW,CAAC,GAAGa,WAAkB,EAAEF,IAAI,CAAQ,EACnGD,KAAK,CACN;AACH,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Composables
|
|
2
2
|
import { useForm } from "./form.mjs";
|
|
3
|
-
import { useProxiedModel } from "./proxiedModel.mjs";
|
|
4
|
-
|
|
3
|
+
import { useProxiedModel } from "./proxiedModel.mjs";
|
|
4
|
+
import { useToggleScope } from "./toggleScope.mjs";
|
|
5
|
+
import { makeFocusProps } from "./focus.mjs"; // Utilities
|
|
5
6
|
import { computed, onBeforeMount, onBeforeUnmount, onMounted, ref, unref, watch } from 'vue';
|
|
6
7
|
import { getCurrentInstanceName, getUid, propsFactory, wrapInArray } from "../util/index.mjs"; // Types
|
|
7
|
-
|
|
8
8
|
export const makeValidationProps = propsFactory({
|
|
9
9
|
disabled: Boolean,
|
|
10
10
|
error: Boolean,
|
|
@@ -17,23 +17,22 @@ export const makeValidationProps = propsFactory({
|
|
|
17
17
|
default: 1
|
|
18
18
|
},
|
|
19
19
|
name: String,
|
|
20
|
+
label: String,
|
|
20
21
|
readonly: Boolean,
|
|
21
22
|
rules: {
|
|
22
23
|
type: Array,
|
|
23
24
|
default: () => []
|
|
24
25
|
},
|
|
25
26
|
modelValue: null,
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
validateOn: String,
|
|
28
|
+
validationValue: null,
|
|
29
|
+
...makeFocusProps()
|
|
30
|
+
}, 'validation');
|
|
28
31
|
export function useValidation(props) {
|
|
29
32
|
let name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getCurrentInstanceName();
|
|
30
33
|
let id = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : getUid();
|
|
31
34
|
const model = useProxiedModel(props, 'modelValue');
|
|
32
|
-
const validationModel = computed(() =>
|
|
33
|
-
var _props$validationValu;
|
|
34
|
-
|
|
35
|
-
return (_props$validationValu = props.validationValue) != null ? _props$validationValu : model.value;
|
|
36
|
-
});
|
|
35
|
+
const validationModel = computed(() => props.validationValue === undefined ? model.value : props.validationValue);
|
|
37
36
|
const form = useForm();
|
|
38
37
|
const internalErrorMessages = ref([]);
|
|
39
38
|
const isPristine = ref(true);
|
|
@@ -57,11 +56,7 @@ export function useValidation(props) {
|
|
|
57
56
|
[`${name}--readonly`]: isReadonly.value
|
|
58
57
|
};
|
|
59
58
|
});
|
|
60
|
-
const uid = computed(() =>
|
|
61
|
-
var _props$name;
|
|
62
|
-
|
|
63
|
-
return (_props$name = props.name) != null ? _props$name : unref(id);
|
|
64
|
-
});
|
|
59
|
+
const uid = computed(() => props.name ?? unref(id));
|
|
65
60
|
onBeforeMount(() => {
|
|
66
61
|
form == null ? void 0 : form.register({
|
|
67
62
|
id: uid.value,
|
|
@@ -72,54 +67,61 @@ export function useValidation(props) {
|
|
|
72
67
|
});
|
|
73
68
|
onBeforeUnmount(() => {
|
|
74
69
|
form == null ? void 0 : form.unregister(uid.value);
|
|
75
|
-
});
|
|
70
|
+
});
|
|
71
|
+
const validateOn = computed(() => props.validateOn || (form == null ? void 0 : form.validateOn.value) || 'input');
|
|
76
72
|
|
|
73
|
+
// Set initial valid state, for inputs that might not have rules
|
|
77
74
|
onMounted(() => form == null ? void 0 : form.update(uid.value, isValid.value, errorMessages.value));
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
useToggleScope(() => validateOn.value === 'input', () => {
|
|
76
|
+
watch(validationModel, () => {
|
|
77
|
+
if (validationModel.value != null) {
|
|
78
|
+
validate();
|
|
79
|
+
} else if (props.focused) {
|
|
80
|
+
const unwatch = watch(() => props.focused, val => {
|
|
81
|
+
if (!val) validate();
|
|
82
|
+
unwatch();
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
useToggleScope(() => validateOn.value === 'blur', () => {
|
|
88
|
+
watch(() => props.focused, val => {
|
|
89
|
+
if (!val) validate();
|
|
90
|
+
});
|
|
80
91
|
});
|
|
81
92
|
watch(isValid, () => {
|
|
82
93
|
form == null ? void 0 : form.update(uid.value, isValid.value, errorMessages.value);
|
|
83
94
|
});
|
|
84
|
-
|
|
85
95
|
function reset() {
|
|
86
96
|
resetValidation();
|
|
87
97
|
model.value = null;
|
|
88
98
|
}
|
|
89
|
-
|
|
90
99
|
function resetValidation() {
|
|
91
100
|
isPristine.value = true;
|
|
92
101
|
internalErrorMessages.value = [];
|
|
93
102
|
}
|
|
94
|
-
|
|
95
103
|
async function validate() {
|
|
96
104
|
const results = [];
|
|
97
105
|
isValidating.value = true;
|
|
98
|
-
|
|
99
106
|
for (const rule of props.rules) {
|
|
100
107
|
if (results.length >= (props.maxErrors || 1)) {
|
|
101
108
|
break;
|
|
102
109
|
}
|
|
103
|
-
|
|
104
110
|
const handler = typeof rule === 'function' ? rule : () => rule;
|
|
105
111
|
const result = await handler(validationModel.value);
|
|
106
112
|
if (result === true) continue;
|
|
107
|
-
|
|
108
113
|
if (typeof result !== 'string') {
|
|
109
114
|
// eslint-disable-next-line no-console
|
|
110
115
|
console.warn(`${result} is not a valid value. Rule functions must return boolean true or a string.`);
|
|
111
116
|
continue;
|
|
112
117
|
}
|
|
113
|
-
|
|
114
118
|
results.push(result);
|
|
115
119
|
}
|
|
116
|
-
|
|
117
120
|
internalErrorMessages.value = results;
|
|
118
121
|
isValidating.value = false;
|
|
119
122
|
isPristine.value = false;
|
|
120
123
|
return internalErrorMessages.value;
|
|
121
124
|
}
|
|
122
|
-
|
|
123
125
|
return {
|
|
124
126
|
errorMessages,
|
|
125
127
|
isDirty,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.mjs","names":["useForm","useProxiedModel","computed","onBeforeMount","onBeforeUnmount","onMounted","ref","unref","watch","getCurrentInstanceName","getUid","propsFactory","wrapInArray","makeValidationProps","disabled","Boolean","error","errorMessages","type","Array","String","default","maxErrors","Number","name","readonly","rules","modelValue","validationValue","useValidation","props","id","model","validationModel","value","form","internalErrorMessages","isPristine","isDirty","length","isDisabled","isReadonly","isValid","isValidating","validationClasses","uid","register","validate","reset","resetValidation","unregister","update","results","rule","handler","result","console","warn","push"],"sources":["../../src/composables/validation.ts"],"sourcesContent":["// Composables\nimport { useForm } from '@/composables/form'\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Utilities\nimport { computed, onBeforeMount, onBeforeUnmount, onMounted, ref, unref, watch } from 'vue'\nimport { getCurrentInstanceName, getUid, propsFactory, wrapInArray } from '@/util'\n\n// Types\nimport type { PropType } from 'vue'\nimport type { 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\nexport interface ValidationProps {\n disabled: boolean\n error: boolean\n errorMessages: string | string[]\n maxErrors: string | number\n name: string | undefined\n readonly: boolean\n rules: ValidationRule[]\n modelValue: any\n 'onUpdate:modelValue': ((val: any) => void) | undefined\n validationValue: any\n}\n\nexport const makeValidationProps = propsFactory({\n disabled: Boolean,\n error: Boolean,\n errorMessages: {\n type: [Array, String] as PropType<string | string[]>,\n default: () => ([]),\n },\n maxErrors: {\n type: [Number, String],\n default: 1,\n },\n name: String,\n readonly: Boolean,\n rules: {\n type: Array as PropType<ValidationRule[]>,\n default: () => ([]),\n },\n modelValue: null,\n validationValue: null,\n})\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 ?? model.value)\n const form = useForm()\n const internalErrorMessages = ref<string[]>([])\n const isPristine = ref(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)\n : internalErrorMessages.value\n })\n const isValid = computed(() => {\n if (props.error || errorMessages.value.length) return false\n if (!props.rules.length) return true\n\n return isPristine.value ? null : true\n })\n const isValidating = ref(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 uid = computed(() => props.name ?? unref(id))\n\n onBeforeMount(() => {\n form?.register({\n id: uid.value,\n validate,\n reset,\n resetValidation,\n })\n })\n\n onBeforeUnmount(() => {\n form?.unregister(uid.value)\n })\n\n // Set initial valid state, for inputs that might not have rules\n onMounted(() => form?.update(uid.value, isValid.value, errorMessages.value))\n\n watch(validationModel, () => {\n if (validationModel.value != null) validate()\n })\n\n watch(isValid, () => {\n form?.update(uid.value, isValid.value, errorMessages.value)\n })\n\n function reset () {\n resetValidation()\n model.value = null\n }\n\n function resetValidation () {\n isPristine.value = true\n internalErrorMessages.value = []\n }\n\n async function validate () {\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 (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 = false\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;SACSA,O;SACAC,e,8BAET;;AACA,SAASC,QAAT,EAAmBC,aAAnB,EAAkCC,eAAlC,EAAmDC,SAAnD,EAA8DC,GAA9D,EAAmEC,KAAnE,EAA0EC,KAA1E,QAAuF,KAAvF;SACSC,sB,EAAwBC,M,EAAQC,Y,EAAcC,W,6BAEvD;;AAwBA,OAAO,MAAMC,mBAA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BvB,KAAK,CAACJ,KAAzB,EAAgC;MAC9B,IAAI0B,OAAO,CAACb,MAAR,KAAmBT,KAAK,CAACR,SAAN,IAAmB,CAAtC,CAAJ,EAA8C;QAC5C;MACD;;MAED,MAAMgC,OAAO,GAAG,OAAOD,IAAP,KAAgB,UAAhB,GAA6BA,IAA7B,GAAoC,MAAMA,IAA1D;MACA,MAAME,MAAM,GAAG,MAAMD,OAAO,CAACrB,eAAe,CAACC,KAAjB,CAA5B;MAEA,IAAIqB,MAAM,KAAK,IAAf,EAAqB;;MAErB,IAAI,OAAOA,MAAP,KAAkB,QAAtB,EAAgC;QAC9B;QACAC,OAAO,CAACC,IAAR,CAAc,GAAEF,MAAO,6EAAvB;QAEA;MACD;;MAEDH,OAAO,CAACM,IAAR,CAAaH,MAAb;IACD;;IAEDnB,qBAAqB,CAACF,KAAtB,GAA8BkB,OAA9B;IACAT,YAAY,CAACT,KAAb,GAAqB,KAArB;IACAG,UAAU,CAACH,KAAX,GAAmB,KAAnB;IAEA,OAAOE,qBAAqB,CAACF,KAA7B;EACD;;EAED,OAAO;IACLjB,aADK;IAELqB,OAFK;IAGLE,UAHK;IAILC,UAJK;IAKLJ,UALK;IAMLK,OANK;IAOLC,YAPK;IAQLK,KARK;IASLC,eATK;IAULF,QAVK;IAWLH;EAXK,CAAP;AAaD"}
|
|
1
|
+
{"version":3,"file":"validation.mjs","names":["useForm","useProxiedModel","useToggleScope","makeFocusProps","computed","onBeforeMount","onBeforeUnmount","onMounted","ref","unref","watch","getCurrentInstanceName","getUid","propsFactory","wrapInArray","makeValidationProps","disabled","Boolean","error","errorMessages","type","Array","String","default","maxErrors","Number","name","label","readonly","rules","modelValue","validateOn","validationValue","useValidation","props","id","model","validationModel","undefined","value","form","internalErrorMessages","isPristine","isDirty","length","isDisabled","isReadonly","isValid","isValidating","validationClasses","uid","register","validate","reset","resetValidation","unregister","update","focused","unwatch","val","results","rule","handler","result","console","warn","push"],"sources":["../../src/composables/validation.ts"],"sourcesContent":["// Composables\nimport { useForm } from '@/composables/form'\nimport { useProxiedModel } from '@/composables/proxiedModel'\nimport { useToggleScope } from '@/composables/toggleScope'\nimport { makeFocusProps } from '@/composables/focus'\n\n// Utilities\nimport { computed, onBeforeMount, onBeforeUnmount, onMounted, ref, unref, watch } from 'vue'\nimport { getCurrentInstanceName, getUid, propsFactory, wrapInArray } from '@/util'\n\n// Types\nimport type { PropType } from 'vue'\nimport type { 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\nexport interface ValidationProps {\n disabled: boolean\n error: boolean\n errorMessages: string | string[]\n focused: boolean\n maxErrors: string | number\n name: string | undefined\n label: string | undefined\n readonly: boolean\n rules: ValidationRule[]\n modelValue: any\n 'onUpdate:modelValue': ((val: any) => void) | undefined\n validateOn?: 'blur' | 'input' | 'submit'\n validationValue: any\n}\n\nexport const makeValidationProps = propsFactory({\n disabled: Boolean,\n error: Boolean,\n errorMessages: {\n type: [Array, String] as PropType<string | string[]>,\n default: () => ([]),\n },\n maxErrors: {\n type: [Number, String],\n default: 1,\n },\n name: String,\n label: String,\n readonly: Boolean,\n rules: {\n type: Array as PropType<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 = ref(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)\n : internalErrorMessages.value\n })\n const isValid = computed(() => {\n if (props.error || errorMessages.value.length) return false\n if (!props.rules.length) return true\n\n return isPristine.value ? null : true\n })\n const isValidating = ref(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 uid = computed(() => props.name ?? unref(id))\n\n onBeforeMount(() => {\n form?.register({\n id: uid.value,\n validate,\n reset,\n resetValidation,\n })\n })\n\n onBeforeUnmount(() => {\n form?.unregister(uid.value)\n })\n\n const validateOn = computed(() => props.validateOn || form?.validateOn.value || 'input')\n\n // Set initial valid state, for inputs that might not have rules\n onMounted(() => form?.update(uid.value, isValid.value, errorMessages.value))\n\n useToggleScope(() => validateOn.value === 'input', () => {\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, () => {\n form?.update(uid.value, isValid.value, errorMessages.value)\n })\n\n function reset () {\n resetValidation()\n model.value = null\n }\n\n function resetValidation () {\n isPristine.value = true\n internalErrorMessages.value = []\n }\n\n async function validate () {\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 (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 = false\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,OAAO;AAAA,SACPC,eAAe;AAAA,SACfC,cAAc;AAAA,SACdC,cAAc,uBAEvB;AACA,SAASC,QAAQ,EAAEC,aAAa,EAAEC,eAAe,EAAEC,SAAS,EAAEC,GAAG,EAAEC,KAAK,EAAEC,KAAK,QAAQ,KAAK;AAAA,SACnFC,sBAAsB,EAAEC,MAAM,EAAEC,YAAY,EAAEC,WAAW,6BAElE;AA2BA,OAAO,MAAMC,mBAAmB,GAAGF,YAAY,CAAC;EAC9CG,QAAQ,EAAEC,OAAO;EACjBC,KAAK,EAAED,OAAO;EACdE,aAAa,EAAE;IACbC,IAAI,EAAE,CAACC,KAAK,EAAEC,MAAM,CAAgC;IACpDC,OAAO,EAAE,MAAO;EAClB,CAAC;EACDC,SAAS,EAAE;IACTJ,IAAI,EAAE,CAACK,MAAM,EAAEH,MAAM,CAAC;IACtBC,OAAO,EAAE;EACX,CAAC;EACDG,IAAI,EAAEJ,MAAM;EACZK,KAAK,EAAEL,MAAM;EACbM,QAAQ,EAAEX,OAAO;EACjBY,KAAK,EAAE;IACLT,IAAI,EAAEC,KAAmC;IACzCE,OAAO,EAAE,MAAO;EAClB,CAAC;EACDO,UAAU,EAAE,IAAI;EAChBC,UAAU,EAAET,MAAiD;EAC7DU,eAAe,EAAE,IAAI;EAErB,GAAG7B,cAAc;AACnB,CAAC,EAAE,YAAY,CAAC;AAEhB,OAAO,SAAS8B,aAAa,CAC3BC,KAAsB,EAGtB;EAAA,IAFAR,IAAI,uEAAGf,sBAAsB,EAAE;EAAA,IAC/BwB,EAA6B,uEAAGvB,MAAM,EAAE;EAExC,MAAMwB,KAAK,GAAGnC,eAAe,CAACiC,KAAK,EAAE,YAAY,CAAC;EAClD,MA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AAE;QAC5C;MACF;MAEA,MAAMsC,OAAO,GAAG,OAAOD,IAAI,KAAK,UAAU,GAAGA,IAAI,GAAG,MAAMA,IAAI;MAC9D,MAAME,MAAM,GAAG,MAAMD,OAAO,CAACzB,eAAe,CAACE,KAAK,CAAC;MAEnD,IAAIwB,MAAM,KAAK,IAAI,EAAE;MAErB,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE;QAC9B;QACAC,OAAO,CAACC,IAAI,CAAE,GAAEF,MAAO,6EAA4E,CAAC;QAEpG;MACF;MAEAH,OAAO,CAACM,IAAI,CAACH,MAAM,CAAC;IACtB;IAEAtB,qBAAqB,CAACF,KAAK,GAAGqB,OAAO;IACrCZ,YAAY,CAACT,KAAK,GAAG,KAAK;IAC1BG,UAAU,CAACH,KAAK,GAAG,KAAK;IAExB,OAAOE,qBAAqB,CAACF,KAAK;EACpC;EAEA,OAAO;IACLpB,aAAa;IACbwB,OAAO;IACPE,UAAU;IACVC,UAAU;IACVJ,UAAU;IACVK,OAAO;IACPC,YAAY;IACZK,KAAK;IACLC,eAAe;IACfF,QAAQ;IACRH;EACF,CAAC;AACH"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { createVNode as _createVNode, Fragment as _Fragment } from "vue";
|
|
2
2
|
// Composables
|
|
3
3
|
import { useColor } from "./color.mjs"; // Utilities
|
|
4
|
-
|
|
5
4
|
import { computed, unref } from 'vue';
|
|
6
5
|
import { getCurrentInstanceName, propsFactory } from "../util/index.mjs"; // Types
|
|
7
|
-
|
|
8
6
|
export const allowedVariants = ['elevated', 'flat', 'tonal', 'outlined', 'text', 'plain'];
|
|
9
7
|
export function genOverlays(isClickable, name) {
|
|
10
8
|
return _createVNode(_Fragment, null, [isClickable && _createVNode("span", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variant.mjs","names":["useColor","computed","unref","getCurrentInstanceName","propsFactory","allowedVariants","genOverlays","isClickable","name","makeVariantProps","color","String","variant","type","default","validator","v","includes","useVariant","props","variantClasses","colorClasses","colorStyles"],"sources":["../../src/composables/variant.tsx"],"sourcesContent":["// Composables\nimport { useColor } from '@/composables/color'\n\n// Utilities\nimport { computed, unref } from 'vue'\nimport { getCurrentInstanceName, propsFactory } from '@/util'\n\n// Types\nimport type { PropType } from 'vue'\nimport type { MaybeRef } from '@/util'\n\nexport const allowedVariants = [\n 'elevated',\n 'flat',\n 'tonal',\n 'outlined',\n 'text',\n 'plain',\n] as const\n\nexport type Variant = typeof allowedVariants[number]\n\nexport interface VariantProps {\n color?: string\n variant: Variant\n}\n\nexport function genOverlays (isClickable: boolean, name: string) {\n return (\n <>\n { isClickable && <span key=\"overlay\" class={`${name}__overlay`} /> }\n\n <span key=\"underlay\" class={`${name}__underlay`} />\n </>\n )\n}\n\nexport const makeVariantProps = propsFactory({\n color: String,\n variant: {\n type: String as PropType<Variant>,\n default: 'elevated',\n validator: (v: any) => allowedVariants.includes(v),\n },\n}, 'variant')\n\nexport function useVariant (\n props: MaybeRef<VariantProps>,\n name = getCurrentInstanceName(),\n) {\n const variantClasses = computed(() => {\n const { variant } = unref(props)\n return `${name}--variant-${variant}`\n })\n\n const { colorClasses, colorStyles } = useColor(computed(() => {\n const { variant, color } = unref(props)\n return {\n [['elevated', 'flat'].includes(variant) ? 'background' : 'text']: color,\n }\n }))\n\n return { colorClasses, colorStyles, variantClasses }\n}\n"],"mappings":";AAAA;SACSA,
|
|
1
|
+
{"version":3,"file":"variant.mjs","names":["useColor","computed","unref","getCurrentInstanceName","propsFactory","allowedVariants","genOverlays","isClickable","name","makeVariantProps","color","String","variant","type","default","validator","v","includes","useVariant","props","variantClasses","colorClasses","colorStyles"],"sources":["../../src/composables/variant.tsx"],"sourcesContent":["// Composables\nimport { useColor } from '@/composables/color'\n\n// Utilities\nimport { computed, unref } from 'vue'\nimport { getCurrentInstanceName, propsFactory } from '@/util'\n\n// Types\nimport type { PropType } from 'vue'\nimport type { MaybeRef } from '@/util'\n\nexport const allowedVariants = [\n 'elevated',\n 'flat',\n 'tonal',\n 'outlined',\n 'text',\n 'plain',\n] as const\n\nexport type Variant = typeof allowedVariants[number]\n\nexport interface VariantProps {\n color?: string\n variant: Variant\n}\n\nexport function genOverlays (isClickable: boolean, name: string) {\n return (\n <>\n { isClickable && <span key=\"overlay\" class={`${name}__overlay`} /> }\n\n <span key=\"underlay\" class={`${name}__underlay`} />\n </>\n )\n}\n\nexport const makeVariantProps = propsFactory({\n color: String,\n variant: {\n type: String as PropType<Variant>,\n default: 'elevated',\n validator: (v: any) => allowedVariants.includes(v),\n },\n}, 'variant')\n\nexport function useVariant (\n props: MaybeRef<VariantProps>,\n name = getCurrentInstanceName(),\n) {\n const variantClasses = computed(() => {\n const { variant } = unref(props)\n return `${name}--variant-${variant}`\n })\n\n const { colorClasses, colorStyles } = useColor(computed(() => {\n const { variant, color } = unref(props)\n return {\n [['elevated', 'flat'].includes(variant) ? 'background' : 'text']: color,\n }\n }))\n\n return { colorClasses, colorStyles, variantClasses }\n}\n"],"mappings":";AAAA;AAAA,SACSA,QAAQ,uBAEjB;AACA,SAASC,QAAQ,EAAEC,KAAK,QAAQ,KAAK;AAAA,SAC5BC,sBAAsB,EAAEC,YAAY,6BAE7C;AAIA,OAAO,MAAMC,eAAe,GAAG,CAC7B,UAAU,EACV,MAAM,EACN,OAAO,EACP,UAAU,EACV,MAAM,EACN,OAAO,CACC;AASV,OAAO,SAASC,WAAW,CAAEC,WAAoB,EAAEC,IAAY,EAAE;EAC/D,sCAEMD,WAAW;IAAA,OAAc,SAAS;IAAA,SAAS,GAAEC,IAAK;EAAU,QAAI;IAAA,OAExD,UAAU;IAAA,SAAS,GAAEA,IAAK;EAAW;AAGrD;AAEA,OAAO,MAAMC,gBAAgB,GAAGL,YAAY,CAAC;EAC3CM,KAAK,EAAEC,MAAM;EACbC,OAAO,EAAE;IACPC,IAAI,EAAEF,MAA2B;IACjCG,OAAO,EAAE,UAAU;IACnBC,SAAS,EAAGC,CAAM,IAAKX,eAAe,CAACY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