File tree Expand file tree Collapse file tree
src/lib/components/ui/carousel Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99
1010 let {
1111 ref = $bindable (null ),
12- opts = {},
13- plugins = [],
12+ opts : _opts = {},
13+ plugins : _plugins = [],
1414 setApi = () => {},
15- orientation = " horizontal" ,
15+ orientation : _orientation = " horizontal" ,
1616 class : className,
1717 children,
1818 ... restProps
1919 }: WithElementRef <CarouselProps > = $props ();
2020
21+ const opts = $derived (_opts );
22+ const plugins = $derived (_plugins );
23+ const orientation = $derived (_orientation );
24+
2125 let carouselState = $state <EmblaContext >({
22- api: undefined ,
23- scrollPrev ,
24- scrollNext ,
25- orientation ,
26- canScrollNext: false ,
27- canScrollPrev: false ,
28- handleKeyDown ,
29- options: opts ,
30- plugins ,
31- onInit ,
32- scrollSnaps: [],
33- selectedIndex: 0 ,
34- scrollTo ,
35- });
26+ api: undefined ,
27+ scrollPrev ,
28+ scrollNext ,
29+ orientation: " horizontal" ,
30+ canScrollNext: false ,
31+ canScrollPrev: false ,
32+ handleKeyDown ,
33+ options: {},
34+ plugins: [],
35+ onInit ,
36+ scrollSnaps: [],
37+ selectedIndex: 0 ,
38+ scrollTo ,
39+ });
40+
41+ setEmblaContext (carouselState );
3642
37- setEmblaContext (carouselState );
43+ $effect (() => {
44+ carouselState .orientation = orientation ;
45+ carouselState .options = opts ;
46+ carouselState .plugins = plugins ;
47+ });
3848
3949 function scrollPrev() {
4050 carouselState .api ?.scrollPrev ();
You can’t perform that action at this time.
0 commit comments