Skip to content

Commit

Permalink
Merge branch 'master' into feat/20928-vdatepicker-today-attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
maryamBaratii authored Feb 10, 2025
2 parents bf0d52f + cb8b44a commit 9b5b397
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 16 deletions.
4 changes: 2 additions & 2 deletions packages/vuetify/build/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export default [
(await this.resolve('src/components/index.ts')).id
)
await Promise.all(importedIds.map(async id => {
const importFrom = path.relative(srcDir, id).replace(/\/index\.ts$/, '')
const importFrom = path.relative(srcDir, id).replace(/\.ts$/, '.mjs')

if (await this.resolve(path.join(id, '../_variables.scss')) != null) {
variables.push(id)
Expand Down Expand Up @@ -247,7 +247,7 @@ export default [
(await this.resolve('src/labs/components.ts')).id
)
await Promise.all(importedIds.map(async id => {
const importFrom = path.relative(srcDir, id).replace(/\/index\.ts$/, '')
const importFrom = path.relative(srcDir, id).replace(/\.ts$/, '.mjs')

if (await this.resolve(path.join(id, '../_variables.scss')) != null) {
variables.push(id)
Expand Down
4 changes: 2 additions & 2 deletions packages/vuetify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@
},
"peerDependencies": {
"typescript": ">=4.7",
"vite-plugin-vuetify": ">=2.1.0",
"vite-plugin-vuetify": ">=1.0.0",
"vue": "^3.3.0",
"webpack-plugin-vuetify": ">=3.1.0"
"webpack-plugin-vuetify": ">=2.0.0"
},
"peerDependenciesMeta": {
"typescript": {
Expand Down
3 changes: 2 additions & 1 deletion packages/vuetify/src/components/VOverlay/VOverlay.sass
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
height: 100%

.v-overlay
--v-overlay-opacity: #{$overlay-opacity}
border-radius: inherit
display: flex
left: 0
Expand All @@ -48,7 +49,7 @@
border-radius: inherit
bottom: 0
left: 0
opacity: $overlay-opacity
opacity: var(--v-overlay-opacity)
position: fixed
right: 0
top: 0
Expand Down
2 changes: 1 addition & 1 deletion packages/vuetify/src/components/VOverlay/_variables.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Defaults
$overlay-opacity: var(--v-overlay-opacity, 0.32) !default;
$overlay-opacity: 0.32 !default;
$overlay-scrim-background: rgb(var(--v-theme-on-surface)) !default;
29 changes: 22 additions & 7 deletions packages/vuetify/src/components/VSlider/slider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type SliderProvide = {
numTicks: Ref<number>
onSliderMousedown: (e: MouseEvent) => void
onSliderTouchstart: (e: TouchEvent) => void
parseMouseMove: (e: MouseEvent | TouchEvent) => number
parseMouseMove: (e: MouseEvent | TouchEvent) => number | void
position: (val: number) => number
readonly: Ref<boolean | null | undefined>
rounded: Ref<boolean | number | string | undefined>
Expand Down Expand Up @@ -205,7 +205,11 @@ export const useSlider = ({
const trackContainerRef = ref<VSliderTrack | undefined>()
const activeThumbRef = ref<HTMLElement | undefined>()

function parseMouseMove (e: MouseEvent | TouchEvent): number {
function parseMouseMove (e: MouseEvent | TouchEvent): number | void {
const el: HTMLElement = trackContainerRef.value?.$el

if (!el) return

const vertical = props.direction === 'vertical'
const start = vertical ? 'top' : 'left'
const length = vertical ? 'height' : 'width'
Expand All @@ -214,7 +218,7 @@ export const useSlider = ({
const {
[start]: trackStart,
[length]: trackLength,
} = trackContainerRef.value?.$el.getBoundingClientRect()
} = el.getBoundingClientRect()
const clickOffset = getPosition(e, position)

// It is possible for left to be NaN, force to number
Expand All @@ -226,13 +230,17 @@ export const useSlider = ({
}

const handleStop = (e: MouseEvent | TouchEvent) => {
onSliderEnd({ value: parseMouseMove(e) })
const value = parseMouseMove(e)
if (value != null) {
onSliderEnd({ value })
}

mousePressed.value = false
startOffset.value = 0
}

const handleStart = (e: MouseEvent | TouchEvent) => {
const value = parseMouseMove(e)
activeThumbRef.value = getActiveThumb(e)

if (!activeThumbRef.value) return
Expand All @@ -243,17 +251,24 @@ export const useSlider = ({
startOffset.value = getOffset(e, activeThumbRef.value, props.direction)
} else {
startOffset.value = 0
onSliderMove({ value: parseMouseMove(e) })
if (value != null) {
onSliderMove({ value })
}
}

onSliderStart({ value: parseMouseMove(e) })
if (value != null) {
onSliderStart({ value })
}
nextTick(() => activeThumbRef.value?.focus())
}

const moveListenerOptions = { passive: true, capture: true }

function onMouseMove (e: MouseEvent | TouchEvent) {
onSliderMove({ value: parseMouseMove(e) })
const value = parseMouseMove(e)
if (value != null) {
onSliderMove({ value })
}
}

function onSliderMouseUp (e: MouseEvent) {
Expand Down
20 changes: 17 additions & 3 deletions packages/vuetify/src/composables/list-items.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Utilities
import { computed, shallowRef, toRaw, watchEffect } from 'vue'
import { deepEqual, getPropertyFromItem, isPrimitive, omit, propsFactory } from '@/util'
import { deepEqual, getPropertyFromItem, isPrimitive, omit, pick, propsFactory } from '@/util'

// Types
import type { PropType } from 'vue'
Expand Down Expand Up @@ -81,7 +81,14 @@ export function transformItem (props: Omit<ItemProps, 'items'>, item: any): List
}

export function transformItems (props: Omit<ItemProps, 'items'>, items: ItemProps['items']) {
const _props = toRaw(props)
const _props = pick(props, [
'itemTitle',
'itemValue',
'itemChildren',
'itemProps',
'returnObject',
'valueComparator',
])

const array: ListItem[] = []
for (const item of items) {
Expand Down Expand Up @@ -129,7 +136,14 @@ export function useItems (props: ItemProps) {
const _returnObject = props.returnObject
const hasValueComparator = !!props.valueComparator
const valueComparator = props.valueComparator || deepEqual
const _props = toRaw(props)
const _props = pick(props, [
'itemTitle',
'itemValue',
'itemChildren',
'itemProps',
'returnObject',
'valueComparator',
])

const returnValue: ListItem[] = []
main: for (const v of _value) {
Expand Down

0 comments on commit 9b5b397

Please sign in to comment.