@@ -90,8 +90,6 @@ export default defineComponent({
9090 provide ( 'normalizeDir' , normalizeDir )
9191
9292 function updateBreakpointsConfig ( ) : void {
93- if ( ! props . breakpoints ) return
94-
9593 // Determine the width source based on the 'breakpointMode' config
9694 const widthSource =
9795 ( config . breakpointMode === 'carousel'
@@ -391,10 +389,7 @@ export default defineComponent({
391389 }
392390
393391 // Update the carousel on props change
394- Object . keys ( carouselProps ) . forEach ( ( prop ) => {
395- if ( [ 'modelValue' ] . includes ( prop ) ) return
396- watch ( ( ) => props [ prop as keyof typeof carouselProps ] , restartCarousel )
397- } )
392+ watch ( ( ) => ( { ...props } ) , restartCarousel , { deep : true } )
398393
399394 // Handle changing v-model value
400395 watch (
@@ -437,17 +432,58 @@ export default defineComponent({
437432 data,
438433 } )
439434
435+ /**
436+ * Track style
437+ */
438+ const trackTransform : ComputedRef < string > = computed ( ( ) => {
439+ // Calculate the scrolled index with wrapping offset if applicable
440+ const scrolledIndex = getScrolledIndex ( {
441+ config,
442+ currentSlide : currentSlideIndex . value ,
443+ slidesCount : slidesCount . value ,
444+ } )
445+
446+ const cloneOffset = config . wrapAround ? slidesCount . value : 0
447+
448+ // Determine direction multiplier for orientation
449+ const isReverseDirection = [ 'rtl' , 'btt' ] . includes ( normalizeDir . value )
450+ const directionMultiplier = isReverseDirection ? - 1 : 1
451+
452+ // Calculate the total offset for slide transformation
453+ const totalOffset =
454+ ( scrolledIndex + cloneOffset ) * effectiveSlideSize . value * directionMultiplier
455+
456+ // Include user drag interaction offset
457+ const dragOffset = isVertical . value ? dragged . y : dragged . x
458+
459+ // Generate the appropriate CSS transformation
460+ const translateAxis = isVertical . value ? 'Y' : 'X'
461+ return `translate${ translateAxis } (${ dragOffset - totalOffset } px)`
462+ } )
463+
440464 const slotSlides = slots . default || slots . slides
441465 const slotAddons = slots . addons
442466 const slotsProps = reactive ( data )
443467
444468 return ( ) => {
469+ if ( ! config . enabled ) {
470+ return h (
471+ 'section' ,
472+ {
473+ ref : root ,
474+ class : [ 'carousel' , 'is-disabled' ] ,
475+ } ,
476+ slotSlides ?.( )
477+ )
478+ }
479+
445480 const slidesElements = getSlidesVNodes ( slotSlides ?.( slotsProps ) )
446481 const addonsElements = slotAddons ?.( slotsProps ) || [ ]
447482 slidesElements . forEach (
448483 ( el : typeof SlideComponent , index : number ) => ( el . props . index = index )
449484 )
450485 let output = slidesElements
486+
451487 if ( config . wrapAround ) {
452488 const slidesBefore = slidesElements . map ( ( el : VNode , index : number ) =>
453489 cloneVNode ( el , {
@@ -469,35 +505,6 @@ export default defineComponent({
469505 slides . value = slidesElements
470506 slidesCount . value = Math . max ( slidesElements . length , 1 )
471507
472- /**
473- * Track style
474- */
475- const trackTransform : ComputedRef < string > = computed ( ( ) => {
476- // Calculate the scrolled index with wrapping offset if applicable
477- const scrolledIndex = getScrolledIndex ( {
478- config,
479- currentSlide : currentSlideIndex . value ,
480- slidesCount : slidesCount . value ,
481- } )
482-
483- const cloneOffset = config . wrapAround ? slidesCount . value : 0
484-
485- // Determine direction multiplier for orientation
486- const isReverseDirection = [ 'rtl' , 'btt' ] . includes ( normalizeDir . value )
487- const directionMultiplier = isReverseDirection ? - 1 : 1
488-
489- // Calculate the total offset for slide transformation
490- const totalOffset =
491- ( scrolledIndex + cloneOffset ) * effectiveSlideSize . value * directionMultiplier
492-
493- // Include user drag interaction offset
494- const dragOffset = isVertical . value ? dragged . y : dragged . x
495-
496- // Generate the appropriate CSS transformation
497- const translateAxis = isVertical . value ? 'Y' : 'X'
498- return `translate${ translateAxis } (${ dragOffset - totalOffset } px)`
499- } )
500-
501508 const trackEl = h (
502509 'ol' ,
503510 {
0 commit comments