@raxium/vue-addons-swiper 0.1.1

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.
@@ -0,0 +1,100 @@
1
+ import { computed, createElementBlock, createPropsRestProxy, createVNode, defineComponent, guardReactiveProps, normalizeClass, normalizeProps, openBlock, renderSlot, unref, useTemplateRef, watch } from "vue";
2
+ import { cn } from "@raxium/themes/utils";
3
+ import { useForwardProps } from "@raxium/vue-addons-shared";
4
+ import { merge } from "es-toolkit/compat";
5
+ import { ChevronRight } from "lucide-vue-next";
6
+ import { useSwiper } from "swiper/vue";
7
+ import { useRegistSwiperEmits, useSwiperModule, useSwiperToggleEnabled } from "./utils.js";
8
+ const _hoisted_1 = [
9
+ "data-disabled"
10
+ ];
11
+ const _sfc_main = /* @__PURE__ */ defineComponent({
12
+ __name: "SwiperNavigationNext",
13
+ props: {
14
+ class: {
15
+ type: [
16
+ Boolean,
17
+ null,
18
+ String,
19
+ Object,
20
+ Array
21
+ ]
22
+ },
23
+ swiper: {},
24
+ addIcons: {
25
+ type: Boolean
26
+ },
27
+ hideOnClick: {
28
+ type: Boolean
29
+ },
30
+ disabledClass: {},
31
+ hiddenClass: {},
32
+ lockClass: {},
33
+ navigationDisabledClass: {}
34
+ },
35
+ emits: [
36
+ "navigationHide",
37
+ "navigationShow",
38
+ "navigationPrev",
39
+ "navigationNext"
40
+ ],
41
+ setup (__props, { emit: __emit }) {
42
+ const props = createPropsRestProxy(__props, [
43
+ "class",
44
+ "swiper"
45
+ ]);
46
+ const emit = __emit;
47
+ const effectiveSwiper = computed(()=>__props.swiper ?? useSwiper()?.value);
48
+ const { hasModule } = useSwiperModule(effectiveSwiper);
49
+ const { isCanNext } = useSwiperToggleEnabled(effectiveSwiper);
50
+ const navRef = useTemplateRef("navigation");
51
+ const forwared = useForwardProps(props);
52
+ useRegistSwiperEmits({
53
+ swiperRef: effectiveSwiper,
54
+ emit,
55
+ events: [
56
+ "navigationHide",
57
+ "navigationNext",
58
+ "navigationShow"
59
+ ]
60
+ });
61
+ watch(forwared, ()=>{
62
+ if (!effectiveSwiper.value?.navigation) return;
63
+ effectiveSwiper.value.params.navigation = merge({}, effectiveSwiper.value.params.navigation, forwared.value);
64
+ effectiveSwiper.value.navigation.update();
65
+ });
66
+ watch([
67
+ effectiveSwiper,
68
+ navRef
69
+ ], ([swiper, el])=>{
70
+ if (swiper && hasModule("Navigation") && el) {
71
+ const options = merge({}, "boolean" == typeof swiper.params.navigation ? {} : swiper.params.navigation, forwared.value, {
72
+ enabled: true,
73
+ nextEl: el
74
+ });
75
+ swiper.params.navigation = options;
76
+ swiper.navigation.destroy();
77
+ swiper.navigation.init();
78
+ swiper.navigation.update();
79
+ return ()=>swiper.navigation?.destroy();
80
+ }
81
+ }, {
82
+ immediate: true
83
+ });
84
+ return (_ctx, _cache)=>(openBlock(), createElementBlock("div", {
85
+ ref: "navigation",
86
+ class: normalizeClass(unref(cn)("rui-swiper-navigation_next", __props.class)),
87
+ "data-disabled": unref(isCanNext) ? void 0 : "",
88
+ "data-scope": "swiper",
89
+ "data-part": "navigation-next"
90
+ }, [
91
+ renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({
92
+ disabled: !unref(isCanNext)
93
+ })), ()=>[
94
+ createVNode(unref(ChevronRight))
95
+ ])
96
+ ], 10, _hoisted_1));
97
+ }
98
+ });
99
+ const SwiperNavigationNext = _sfc_main;
100
+ export default SwiperNavigationNext;
@@ -0,0 +1,26 @@
1
+ import type { SwiperNavigationProps } from '.';
2
+ declare var __VLS_1: {
3
+ disabled: boolean;
4
+ };
5
+ type __VLS_Slots = {} & {
6
+ default?: (props: typeof __VLS_1) => any;
7
+ };
8
+ declare const __VLS_base: import("vue").DefineComponent<SwiperNavigationProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
+ navigationHide: () => any;
10
+ navigationShow: () => any;
11
+ navigationPrev: () => any;
12
+ navigationNext: () => any;
13
+ }, string, import("vue").PublicProps, Readonly<SwiperNavigationProps> & Readonly<{
14
+ onNavigationHide?: (() => any) | undefined;
15
+ onNavigationShow?: (() => any) | undefined;
16
+ onNavigationPrev?: (() => any) | undefined;
17
+ onNavigationNext?: (() => any) | undefined;
18
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
20
+ declare const _default: typeof __VLS_export;
21
+ export default _default;
22
+ type __VLS_WithSlots<T, S> = T & {
23
+ new (): {
24
+ $slots: S;
25
+ };
26
+ };
@@ -0,0 +1,100 @@
1
+ import { computed, createElementBlock, createPropsRestProxy, createVNode, defineComponent, guardReactiveProps, normalizeClass, normalizeProps, openBlock, renderSlot, unref, useTemplateRef, watch } from "vue";
2
+ import { cn } from "@raxium/themes/utils";
3
+ import { useForwardProps } from "@raxium/vue-addons-shared";
4
+ import { merge } from "es-toolkit/compat";
5
+ import { ChevronLeft } from "lucide-vue-next";
6
+ import { useSwiper } from "swiper/vue";
7
+ import { useRegistSwiperEmits, useSwiperModule, useSwiperToggleEnabled } from "./utils.js";
8
+ const _hoisted_1 = [
9
+ "data-disabled"
10
+ ];
11
+ const _sfc_main = /* @__PURE__ */ defineComponent({
12
+ __name: "SwiperNavigationPrev",
13
+ props: {
14
+ class: {
15
+ type: [
16
+ Boolean,
17
+ null,
18
+ String,
19
+ Object,
20
+ Array
21
+ ]
22
+ },
23
+ swiper: {},
24
+ addIcons: {
25
+ type: Boolean
26
+ },
27
+ hideOnClick: {
28
+ type: Boolean
29
+ },
30
+ disabledClass: {},
31
+ hiddenClass: {},
32
+ lockClass: {},
33
+ navigationDisabledClass: {}
34
+ },
35
+ emits: [
36
+ "navigationHide",
37
+ "navigationShow",
38
+ "navigationPrev",
39
+ "navigationNext"
40
+ ],
41
+ setup (__props, { emit: __emit }) {
42
+ const props = createPropsRestProxy(__props, [
43
+ "class",
44
+ "swiper"
45
+ ]);
46
+ const emit = __emit;
47
+ const effectiveSwiper = computed(()=>__props.swiper ?? useSwiper()?.value);
48
+ const { hasModule } = useSwiperModule(effectiveSwiper);
49
+ const { isCanPrev } = useSwiperToggleEnabled(effectiveSwiper);
50
+ const navRef = useTemplateRef("navigation");
51
+ const forwared = useForwardProps(props);
52
+ useRegistSwiperEmits({
53
+ swiperRef: effectiveSwiper,
54
+ emit,
55
+ events: [
56
+ "navigationHide",
57
+ "navigationPrev",
58
+ "navigationShow"
59
+ ]
60
+ });
61
+ watch(forwared, ()=>{
62
+ if (!effectiveSwiper.value?.navigation) return;
63
+ effectiveSwiper.value.params.navigation = merge({}, effectiveSwiper.value.params.navigation, forwared.value);
64
+ effectiveSwiper.value.navigation.update();
65
+ });
66
+ watch([
67
+ effectiveSwiper,
68
+ navRef
69
+ ], ([swiper, el])=>{
70
+ if (swiper && hasModule("Navigation") && el) {
71
+ const options = merge({}, "boolean" == typeof swiper.params.navigation ? {} : swiper.params.navigation, forwared.value, {
72
+ enabled: true,
73
+ prevEl: el
74
+ });
75
+ swiper.params.navigation = options;
76
+ swiper.navigation.destroy();
77
+ swiper.navigation.init();
78
+ swiper.navigation.update();
79
+ return ()=>swiper.navigation?.destroy();
80
+ }
81
+ }, {
82
+ immediate: true
83
+ });
84
+ return (_ctx, _cache)=>(openBlock(), createElementBlock("div", {
85
+ ref: "navigation",
86
+ class: normalizeClass(unref(cn)("rui-swiper-navigation_prev", __props.class)),
87
+ "data-disabled": unref(isCanPrev) ? void 0 : "",
88
+ "data-scope": "swiper",
89
+ "data-part": "navigation-prev"
90
+ }, [
91
+ renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({
92
+ disabled: !unref(isCanPrev)
93
+ })), ()=>[
94
+ createVNode(unref(ChevronLeft))
95
+ ])
96
+ ], 10, _hoisted_1));
97
+ }
98
+ });
99
+ const SwiperNavigationPrev = _sfc_main;
100
+ export default SwiperNavigationPrev;
@@ -0,0 +1,26 @@
1
+ import type { SwiperNavigationProps } from '.';
2
+ declare var __VLS_1: {
3
+ disabled: boolean;
4
+ };
5
+ type __VLS_Slots = {} & {
6
+ default?: (props: typeof __VLS_1) => any;
7
+ };
8
+ declare const __VLS_base: import("vue").DefineComponent<SwiperNavigationProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
+ navigationHide: () => any;
10
+ navigationShow: () => any;
11
+ navigationPrev: () => any;
12
+ navigationNext: () => any;
13
+ }, string, import("vue").PublicProps, Readonly<SwiperNavigationProps> & Readonly<{
14
+ onNavigationHide?: (() => any) | undefined;
15
+ onNavigationShow?: (() => any) | undefined;
16
+ onNavigationPrev?: (() => any) | undefined;
17
+ onNavigationNext?: (() => any) | undefined;
18
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
20
+ declare const _default: typeof __VLS_export;
21
+ export default _default;
22
+ type __VLS_WithSlots<T, S> = T & {
23
+ new (): {
24
+ $slots: S;
25
+ };
26
+ };
@@ -0,0 +1,32 @@
1
+ import { computed, createElementBlock, defineComponent, guardReactiveProps, normalizeProps, openBlock, renderSlot, unref } from "vue";
2
+ import { useSwiper } from "swiper/vue";
3
+ import { useSwiperToggleEnabled } from "./utils.js";
4
+ const _hoisted_1 = [
5
+ "data-disabled"
6
+ ];
7
+ const _sfc_main = /* @__PURE__ */ defineComponent({
8
+ __name: "SwiperNext",
9
+ props: {
10
+ swiper: {}
11
+ },
12
+ setup (__props) {
13
+ const effectiveSwiper = computed(()=>__props.swiper ?? useSwiper()?.value);
14
+ const { isCanNext } = useSwiperToggleEnabled(effectiveSwiper);
15
+ function onClick() {
16
+ isCanNext.value && effectiveSwiper.value?.slideNext();
17
+ }
18
+ return (_ctx, _cache)=>(openBlock(), createElementBlock("div", {
19
+ class: "rui-swiper-next",
20
+ "data-disabled": unref(isCanNext) ? void 0 : "",
21
+ "data-scope": "swiper",
22
+ "data-part": "next",
23
+ onClick
24
+ }, [
25
+ renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({
26
+ disabled: !unref(isCanNext)
27
+ })))
28
+ ], 8, _hoisted_1));
29
+ }
30
+ });
31
+ const SwiperNext = _sfc_main;
32
+ export default SwiperNext;
@@ -0,0 +1,18 @@
1
+ import type { Swiper as SwiperInstance } from 'swiper/types';
2
+ type __VLS_Props = {
3
+ swiper?: SwiperInstance;
4
+ };
5
+ type __VLS_Slots = {
6
+ default: (props: {
7
+ disabled: boolean;
8
+ }) => any;
9
+ };
10
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
14
+ type __VLS_WithSlots<T, S> = T & {
15
+ new (): {
16
+ $slots: S;
17
+ };
18
+ };
@@ -0,0 +1,168 @@
1
+ import { computed, createElementBlock, createPropsRestProxy, defineComponent, nextTick, normalizeClass, openBlock, unref, useTemplateRef, watch } from "vue";
2
+ import { getNodeCssVar, rem2px } from "@raxium/shared";
3
+ import { cn } from "@raxium/themes/utils";
4
+ import { useForwardProps } from "@raxium/vue-addons-shared";
5
+ import { merge } from "es-toolkit/compat";
6
+ import { useSwiper } from "swiper/vue";
7
+ import { useRegistSwiperEmits, useSwiperModule } from "./utils.js";
8
+ const _hoisted_1 = [
9
+ "data-type"
10
+ ];
11
+ const _sfc_main = /* @__PURE__ */ defineComponent({
12
+ __name: "SwiperPagination",
13
+ props: {
14
+ type: {},
15
+ class: {
16
+ type: [
17
+ Boolean,
18
+ null,
19
+ String,
20
+ Object,
21
+ Array
22
+ ]
23
+ },
24
+ swiper: {},
25
+ bulletElement: {},
26
+ dynamicBullets: {
27
+ type: Boolean
28
+ },
29
+ dynamicMainBullets: {},
30
+ hideOnClick: {
31
+ type: Boolean
32
+ },
33
+ clickable: {
34
+ type: Boolean
35
+ },
36
+ progressbarOpposite: {
37
+ type: Boolean
38
+ },
39
+ formatFractionCurrent: {
40
+ type: Function
41
+ },
42
+ formatFractionTotal: {
43
+ type: Function
44
+ },
45
+ renderBullet: {
46
+ type: Function
47
+ },
48
+ renderFraction: {
49
+ type: Function
50
+ },
51
+ renderProgressbar: {
52
+ type: Function
53
+ },
54
+ renderCustom: {
55
+ type: Function
56
+ },
57
+ bulletClass: {},
58
+ bulletActiveClass: {},
59
+ modifierClass: {},
60
+ currentClass: {},
61
+ totalClass: {},
62
+ hiddenClass: {},
63
+ progressbarFillClass: {},
64
+ progressbarOppositeClass: {},
65
+ clickableClass: {},
66
+ lockClass: {},
67
+ horizontalClass: {},
68
+ verticalClass: {},
69
+ paginationDisabledClass: {}
70
+ },
71
+ emits: [
72
+ "paginationRender",
73
+ "paginationUpdate",
74
+ "paginationHide",
75
+ "paginationShow"
76
+ ],
77
+ setup (__props, { emit: __emit }) {
78
+ const props = createPropsRestProxy(__props, [
79
+ "class",
80
+ "swiper"
81
+ ]);
82
+ const emit = __emit;
83
+ const effectiveSwiper = computed(()=>__props.swiper ?? useSwiper()?.value);
84
+ const { hasModule } = useSwiperModule(effectiveSwiper);
85
+ const pagiRef = useTemplateRef("pagination");
86
+ const forwared = useForwardProps(props);
87
+ watch([
88
+ effectiveSwiper,
89
+ pagiRef
90
+ ], ([swiper, el])=>{
91
+ if (!swiper || !hasModule("Pagination") || !el) return;
92
+ const cleanups = [];
93
+ if ("autoplay-bullets" === forwared.value.type && hasModule("Autoplay")) {
94
+ const onAutoplayTimeLeft = (_s, _t, percentage)=>{
95
+ el.style.setProperty("--autoplay-percentage", `${100 * Math.max(0, Math.min(1, 1 - percentage))}%`);
96
+ };
97
+ const onPaginationRender = ()=>{
98
+ if (forwared.value.dynamicBullets) {
99
+ const getMinBulletSize = ()=>{
100
+ if (!el) return 0;
101
+ const bullets = swiper.pagination.bullets;
102
+ if (0 === bullets.length) return 0;
103
+ let minSize = 1 / 0;
104
+ bullets.forEach((bullet)=>{
105
+ const style = window.getComputedStyle(bullet);
106
+ const dir = swiper.params.direction;
107
+ if ("horizontal" === dir) {
108
+ const width = parseFloat(style.width) + parseFloat(style.marginLeft) + parseFloat(style.marginRight);
109
+ if (width < minSize) minSize = width;
110
+ } else if ("vertical" === dir) {
111
+ const height = parseFloat(style.height) + parseFloat(style.marginTop) + parseFloat(style.marginBottom);
112
+ if (height < minSize) minSize = height;
113
+ }
114
+ });
115
+ return minSize;
116
+ };
117
+ const activeBulletSize = rem2px(getNodeCssVar(el, "---autoplay-active-bullet-size", "2.5rem"));
118
+ nextTick(()=>{
119
+ if (el) el.style.width = `${getMinBulletSize() * (5 + (forwared.value.dynamicMainBullets ?? 1)) + activeBulletSize}px`;
120
+ });
121
+ }
122
+ };
123
+ swiper.on("paginationRender", onPaginationRender);
124
+ swiper.on("autoplayTimeLeft", onAutoplayTimeLeft);
125
+ cleanups.push(()=>{
126
+ swiper.off("paginationRender", onPaginationRender);
127
+ swiper.off("autoplayTimeLeft", onAutoplayTimeLeft);
128
+ });
129
+ }
130
+ const options = merge({}, "boolean" == typeof swiper.params.pagination ? {} : swiper.params.pagination, forwared.value, {
131
+ enabled: true,
132
+ el,
133
+ type: "autoplay-bullets" === forwared.value.type ? "bullets" : forwared.value.type
134
+ });
135
+ swiper.params.pagination = options;
136
+ swiper.pagination.destroy();
137
+ swiper.pagination.init();
138
+ swiper.pagination.render();
139
+ swiper.pagination.update();
140
+ return ()=>{
141
+ cleanups.forEach((fn)=>fn());
142
+ swiper.pagination?.destroy();
143
+ };
144
+ }, {
145
+ immediate: true
146
+ });
147
+ useRegistSwiperEmits({
148
+ swiperRef: effectiveSwiper,
149
+ emit,
150
+ events: [
151
+ "paginationHide",
152
+ "paginationRender",
153
+ "paginationShow",
154
+ "paginationUpdate"
155
+ ]
156
+ });
157
+ return (_ctx, _cache)=>(openBlock(), createElementBlock("div", {
158
+ ref: "pagination",
159
+ role: "pagination-container",
160
+ class: normalizeClass(unref(cn)("rui-swiper-pagination", __props.class)),
161
+ "data-type": unref(forwared).type,
162
+ "data-scope": "swiper",
163
+ "data-part": "pagination"
164
+ }, null, 10, _hoisted_1));
165
+ }
166
+ });
167
+ const SwiperPagination = _sfc_main;
168
+ export default SwiperPagination;
@@ -0,0 +1,14 @@
1
+ import type { SwiperPaginationProps } from '.';
2
+ declare const __VLS_export: import("vue").DefineComponent<SwiperPaginationProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
+ paginationRender: () => any;
4
+ paginationUpdate: () => any;
5
+ paginationHide: () => any;
6
+ paginationShow: () => any;
7
+ }, string, import("vue").PublicProps, Readonly<SwiperPaginationProps> & Readonly<{
8
+ onPaginationRender?: (() => any) | undefined;
9
+ onPaginationUpdate?: (() => any) | undefined;
10
+ onPaginationHide?: (() => any) | undefined;
11
+ onPaginationShow?: (() => any) | undefined;
12
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
@@ -0,0 +1,32 @@
1
+ import { computed, createElementBlock, defineComponent, guardReactiveProps, normalizeProps, openBlock, renderSlot, unref } from "vue";
2
+ import { useSwiper } from "swiper/vue";
3
+ import { useSwiperToggleEnabled } from "./utils.js";
4
+ const _hoisted_1 = [
5
+ "data-disabled"
6
+ ];
7
+ const _sfc_main = /* @__PURE__ */ defineComponent({
8
+ __name: "SwiperPrev",
9
+ props: {
10
+ swiper: {}
11
+ },
12
+ setup (__props) {
13
+ const effectiveSwiper = computed(()=>__props.swiper ?? useSwiper()?.value);
14
+ const { isCanPrev } = useSwiperToggleEnabled(effectiveSwiper);
15
+ function onClick() {
16
+ isCanPrev.value && effectiveSwiper.value?.slidePrev();
17
+ }
18
+ return (_ctx, _cache)=>(openBlock(), createElementBlock("div", {
19
+ class: "rui-swiper-prev",
20
+ "data-disabled": unref(isCanPrev) ? void 0 : "",
21
+ "data-scope": "swiper",
22
+ "data-part": "prev",
23
+ onClick
24
+ }, [
25
+ renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({
26
+ disabled: !unref(isCanPrev)
27
+ })))
28
+ ], 8, _hoisted_1));
29
+ }
30
+ });
31
+ const SwiperPrev = _sfc_main;
32
+ export default SwiperPrev;
@@ -0,0 +1,18 @@
1
+ import type { Swiper as SwiperInstance } from 'swiper/types';
2
+ type __VLS_Props = {
3
+ swiper?: SwiperInstance;
4
+ };
5
+ type __VLS_Slots = {
6
+ default: (props: {
7
+ disabled: boolean;
8
+ }) => any;
9
+ };
10
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
14
+ type __VLS_WithSlots<T, S> = T & {
15
+ new (): {
16
+ $slots: S;
17
+ };
18
+ };
@@ -0,0 +1,89 @@
1
+ import { computed, createElementBlock, createPropsRestProxy, defineComponent, normalizeClass, openBlock, unref, useTemplateRef, watch } from "vue";
2
+ import { cn } from "@raxium/themes/utils";
3
+ import { useForwardProps } from "@raxium/vue-addons-shared";
4
+ import { merge } from "es-toolkit/compat";
5
+ import { useSwiper } from "swiper/vue";
6
+ import { useRegistSwiperEmits, useSwiperModule } from "./utils.js";
7
+ const _sfc_main = /* @__PURE__ */ defineComponent({
8
+ __name: "SwiperScrollbar",
9
+ props: {
10
+ class: {
11
+ type: [
12
+ Boolean,
13
+ null,
14
+ String,
15
+ Object,
16
+ Array
17
+ ]
18
+ },
19
+ swiper: {},
20
+ hide: {
21
+ type: Boolean
22
+ },
23
+ draggable: {
24
+ type: Boolean
25
+ },
26
+ snapOnRelease: {
27
+ type: Boolean
28
+ },
29
+ dragSize: {},
30
+ lockClass: {},
31
+ dragClass: {},
32
+ scrollbarDisabledClass: {},
33
+ horizontalClass: {},
34
+ verticalClass: {}
35
+ },
36
+ emits: [
37
+ "scrollbarDragStart",
38
+ "scrollbarDragMove",
39
+ "scrollbarDragEnd"
40
+ ],
41
+ setup (__props, { emit: __emit }) {
42
+ const props = createPropsRestProxy(__props, [
43
+ "class",
44
+ "swiper"
45
+ ]);
46
+ const emit = __emit;
47
+ const effectiveSwiper = computed(()=>__props.swiper ?? useSwiper()?.value);
48
+ const { hasModule } = useSwiperModule(effectiveSwiper);
49
+ const scrollRef = useTemplateRef("scrollbar");
50
+ const forwared = useForwardProps(props);
51
+ watch([
52
+ effectiveSwiper,
53
+ scrollRef
54
+ ], ([swiper, el])=>{
55
+ if (swiper && hasModule("Scrollbar") && el) {
56
+ const options = merge({}, "boolean" == typeof swiper.params.scrollbar ? {} : swiper.params.scrollbar, forwared.value, {
57
+ enabled: true,
58
+ el
59
+ });
60
+ swiper.params.scrollbar = options;
61
+ swiper.scrollbar.destroy();
62
+ swiper.scrollbar.init();
63
+ swiper.scrollbar.updateSize();
64
+ swiper.scrollbar.setTranslate();
65
+ return ()=>swiper.scrollbar?.destroy();
66
+ }
67
+ }, {
68
+ immediate: true
69
+ });
70
+ useRegistSwiperEmits({
71
+ swiperRef: effectiveSwiper,
72
+ emit,
73
+ events: [
74
+ "scrollbarDragEnd",
75
+ "scrollbarDragMove",
76
+ "scrollbarDragStart"
77
+ ]
78
+ });
79
+ return (_ctx, _cache)=>(openBlock(), createElementBlock("div", {
80
+ ref: "scrollbar",
81
+ role: "scrollbar-container",
82
+ class: normalizeClass(unref(cn)("rui-swiper-scrollbar", __props.class)),
83
+ "data-scope": "swiper",
84
+ "data-part": "scrollbar"
85
+ }, null, 2));
86
+ }
87
+ });
88
+ const SwiperScrollbar = _sfc_main;
89
+ export default SwiperScrollbar;
@@ -0,0 +1,12 @@
1
+ import type { SwiperScrollbarProps } from '.';
2
+ declare const __VLS_export: import("vue").DefineComponent<SwiperScrollbarProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
+ scrollbarDragStart: () => any;
4
+ scrollbarDragMove: () => any;
5
+ scrollbarDragEnd: () => any;
6
+ }, string, import("vue").PublicProps, Readonly<SwiperScrollbarProps> & Readonly<{
7
+ onScrollbarDragStart?: (() => any) | undefined;
8
+ onScrollbarDragMove?: (() => any) | undefined;
9
+ onScrollbarDragEnd?: (() => any) | undefined;
10
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ declare const _default: typeof __VLS_export;
12
+ export default _default;