@loickit-v/swiper 0.0.6 → 0.0.8

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/README.md CHANGED
@@ -1,152 +1,153 @@
1
1
  # @loickit-v/swiper
2
2
 
3
+ [中文](./README-zh.md)
4
+
3
5
  ## Components
4
6
 
5
7
  ### LSlide
6
-
7
- the Slide Component
8
-
8
+ The Slide Component
9
9
  #### Props
10
+ - `name`
11
+ A unique identifier for the slide, which should be obtained via `defineSlide`.
12
+ - `list <Array>`
13
+ Only takes effect in `infinite` mode; enables automatic cached rendering.
14
+ - `loadMore <Function>`
15
+ Only takes effect in `infinite` mode; triggered when the sliding pointer reaches the end of the list.
10
16
 
11
- - name
12
-
13
- identification of this slide, get by `defineSlide`
14
-
15
- - list \<Array>
16
-
17
- just avaliable `infinite` mode, the long list of render, will cached by `slotScope.cacheList`
18
-
19
- - loadMore \<Function>
20
-
21
- just avaliable `infinite` mode, when the pointer points to the cacheList end, will trigger.
22
-
23
- #### Hooks
24
-
25
- **defineSlide**
26
-
27
- define a slide object
28
-
29
- argument:
30
-
31
- - provideKey \<string>
32
-
33
- the identification of target slide
34
-
35
- return \[createSlide, useSlide]
36
-
37
- - createSlide
38
-
39
- create a slide states, use return value to registe a slide
40
-
41
- params:
42
-
43
- - initial \<SlideState>
44
-
45
- - direction \<SLIDE\*DIRECTION> _optional_
46
17
 
47
- default: SLIDE_DIRECTION.HORIZONTAL
48
-
49
- direction
50
-
51
- - currentIndex \<number> _optional_
52
-
53
- pointer
54
-
55
- - duration \<number> _optional_
56
-
57
- slide switch animation duration
58
-
59
- - infinite \<boolean> `infinite` _optional_
60
-
61
- mode enable
62
-
63
- return:
64
-
65
- - name
66
-
67
- the identification of target slide
18
+ ### LSlideItem
19
+ The Slide Item Component
20
+ #### Props
21
+ - `index <number>` _optional_
22
+ Must be passed in `infinite` mode, used for dynamic rendering calculations.
68
23
 
69
- - state \<SlideState>
70
24
 
71
- the slide state
25
+ ## Hooks
72
26
 
73
- - useSlide
27
+ ### `defineSlide`
28
+ Defines a slide
74
29
 
75
- return: \<SlideSate>
30
+ **Parameters**:
31
+ - `provideKey <string>`
32
+ Sets a unique identifier for the current slide.
76
33
 
77
- use it to get slide state in any child component
34
+ **Returns**:
35
+ `[createSlide, useSlide]`
78
36
 
79
- #### Slot
37
+ - `createSlide`
38
+ Creates a slide state; its return value is used to register the `l-slide` component.
80
39
 
81
- **default**
40
+ **Parameters**:
41
+ - `initial <SlideState>`
42
+ - `direction <SLIDE_DIRECTION>` _optional_
43
+ Sliding direction
44
+ Default value: SLIDE_DIRECTION.HORIZONTAL
45
+ - `currentIndex <number>` _optional_
46
+ Pointer
47
+ Default value: 0
48
+ - `duration <number>` _optional_
49
+ Animation duration for slide switching
50
+ Default value: 300 (ms)
51
+ - `infinite <boolean>` _optional_
52
+ Whether to enable infinite mode
53
+ Default value: false
82
54
 
83
- - cacheList
55
+ **Returns**:
56
+ - `name`
57
+ A unique identifier for the slide, which should be assigned to the `name` prop of `l-slide`.
58
+ - `state <SlideState>`
59
+ The slide state
84
60
 
85
- the cache data of list, just cache 3, just avaliable `infinite` mode
61
+ - `useSlide`
62
+ **Returns**: `<SlideState>`
63
+ Use it to get the current slide state in any child component.
86
64
 
87
- ### LSlideItem
88
-
89
- #### Props
90
65
 
91
- - index \<number> optional
66
+ ## Slot
67
+ **default**
68
+ - `cacheList`
69
+ Only takes effect in `infinite` mode; caches the list data.
92
70
 
93
- the index of this slide item, required when `infinite` mode
94
71
 
95
- ### Usage
72
+ ## Usage
96
73
 
97
74
  ```vue
98
75
  <script setup lang="ts">
99
76
  import {
100
- defineSlide,
101
- LSlide,
102
- LSlideItem,
103
- SLIDE_DIRECTION
77
+ defineSlide,
78
+ LSlide,
79
+ LSlideItem,
80
+ SLIDE_DIRECTION,
81
+ type SlideSwitchEvent
104
82
  } from '@loickit-v/swiper';
83
+ import '@loickit-v/swiper/style';
84
+ import { reactive } from 'vue';
105
85
 
106
- defineOptions({ name: 'App' });
86
+ const handleSwitch = (value: SlideSwitchEvent) => {
87
+ console.log(value);
88
+ };
107
89
 
108
90
  const [createSlide] = defineSlide('one');
109
-
110
91
  const oneSlide = createSlide({
111
- currentIndex: 1
92
+ currentIndex: 1
112
93
  });
113
94
 
114
95
  const [createSlide2] = defineSlide('two');
115
-
116
96
  const twoSlide = createSlide2({
117
- direction: SLIDE_DIRECTION.VERTICAL
97
+ direction: SLIDE_DIRECTION.VERTICAL
118
98
  });
119
-
120
99
  const oneToTwo = () => {
121
- oneSlide.state.currentIndex = 2;
100
+ oneSlide.state.currentIndex = 1;
101
+ };
102
+ const list = reactive([{ id: 1 }, { id: 2 }, { id: 3 }, { id: 4 }, { id: 5 }]);
103
+ const onLoadMore = () => {
104
+ list.push({ id: list[list.length - 1].id + 1 });
122
105
  };
123
106
  </script>
124
107
 
125
108
  <template>
126
- <LSlide :name="oneSlide.name">
127
- <LSlideItem style="background-color: red; width: 30%">1</LSlideItem>
128
- <LSlideItem style="background-color: blue">2</LSlideItem>
129
- <LSlideItem style="background-color: green">
130
- <LSlide :name="twoSlide.name">
131
- <LSlideItem style="background-color: pink; height: 30%">1</LSlideItem>
132
- <LSlideItem style="background-color: orange">2</LSlideItem>
133
- <LSlideItem style="background-color: yellow">3</LSlideItem>
134
- </LSlide>
135
- </LSlideItem>
136
- </LSlide>
137
-
138
- <p>one currentIndex: {{ oneSlide.state.currentIndex }}</p>
139
- <p>two currentIndex: {{ twoSlide.state.currentIndex }}</p>
140
-
141
- <button @click="oneToTwo">click to two slide</button>
109
+ <div style="position: fixed; bottom: 0; left: 0; z-index: 999">
110
+ <p>one currentIndex: {{ oneSlide.state.currentIndex }}</p>
111
+ <p>two currentIndex: {{ twoSlide.state.currentIndex }}</p>
112
+
113
+ <button @click="oneToTwo">click to two "HORIZONTAL-2"</button>
114
+ </div>
115
+ <LSlide :name="oneSlide.name" @switch="handleSwitch">
116
+ <LSlideItem style="background-color: red; width: 30%">
117
+ <h1>HORIZONTAL-1</h1>
118
+ </LSlideItem>
119
+ <LSlideItem style="background-color: blue">
120
+ <h1>HORIZONTAL-2</h1>
121
+ </LSlideItem>
122
+ <LSlideItem style="background-color: green">
123
+ <LSlide
124
+ infinite
125
+ :name="twoSlide.name"
126
+ :list="list"
127
+ :load-more="onLoadMore"
128
+ @switch="handleSwitch"
129
+ >
130
+ <template #="{ cacheList }">
131
+ <LSlideItem
132
+ v-for="(item, idx) in cacheList"
133
+ :key="item.id"
134
+ :index="idx"
135
+ >
136
+ <h1>INFINITE-VERTICAL</h1>
137
+ <h2>{{ item.id }}</h2>
138
+ </LSlideItem>
139
+ </template>
140
+ </LSlide>
141
+ </LSlideItem>
142
+ </LSlide>
142
143
  </template>
143
144
 
144
145
  <style lang="scss">
145
146
  body,
146
147
  #app {
147
- background-color: #ccc;
148
- height: 800px;
149
- width: 800px;
148
+ background-color: #ccc;
149
+ height: 800px;
150
+ width: 800px;
150
151
  }
151
152
  </style>
152
- ```
153
+ ```
@@ -1,99 +1,110 @@
1
- import { defineComponent as T, reactive as A, provide as H, ref as N, watch as k, computed as _, onMounted as V, createElementBlock as Z, openBlock as $, withModifiers as f, createElementVNode as B, normalizeStyle as X, unref as c, renderSlot as y, nextTick as Y } from "vue";
2
- import { u_setStyle as b } from "@likcheung/shared";
3
- import { u_setTransform as m, u_setFlush as j } from "../../utils/index.js";
1
+ import { defineComponent as H, ref as w, watch as y, computed as g, onMounted as V, createElementBlock as Z, openBlock as $, withModifiers as d, createElementVNode as X, normalizeStyle as Y, unref as f, renderSlot as k, reactive as b, provide as j, nextTick as q } from "vue";
2
+ import { u_setStyle as z } from "@likcheung/shared";
3
+ import { u_setTransform as m, u_setFlush as F } from "../../utils/index.js";
4
4
  import { SLIDE_DIRECTION as v } from "../constant/index.js";
5
- import { checkDirection as z } from "../../utils/slide.js";
6
- import { COMMON_SLIDE_PROVIDE_NAME as O } from "../constant/private.js";
7
- import { useSlideState as F } from "../Provide/index.js";
8
- import { defaultState as U } from "../../hooks/defineSlide/default.js";
9
- import { useSlidePrivateProvide as q } from "./provide.js";
10
- const oe = /* @__PURE__ */ T({
5
+ import { checkDirection as U } from "../../utils/slide.js";
6
+ import { COMMON_SLIDE_PROVIDE_NAME as M } from "../constant/private.js";
7
+ import { useSlideState as G } from "../Provide/index.js";
8
+ import { defaultState as J } from "../../hooks/defineSlide/default.js";
9
+ import { createSlidePrivateProvide as K } from "./provide.js";
10
+ const le = /* @__PURE__ */ H({
11
11
  name: "LSlide",
12
12
  __name: "index",
13
13
  props: {
14
- name: { default: O },
14
+ name: { default: M },
15
+ infinite: { type: Boolean },
15
16
  list: { default: () => [] },
16
17
  loadMore: {}
17
18
  },
18
19
  emits: ["switch"],
19
- setup(S, { emit: g }) {
20
- const n = S, w = g, a = () => {
21
- b(r.value, "transition-duration", `${e.duration}ms`), m(e.direction, r.value, -s.value);
22
- }, x = q({
23
- name: n.name,
24
- itemsInfo: []
25
- }), e = n.name !== O ? F(n.name) : (() => {
26
- const t = A(U);
27
- return H(n.name, t), t;
28
- })(), p = () => n.list.slice(e.currentIndex, e.currentIndex + 3), o = e.infinite ? N(p()) : null;
29
- e.infinite && k(
30
- () => n.list,
20
+ setup(S, { emit: _ }) {
21
+ var I;
22
+ const t = S;
23
+ if (t.infinite && !((I = t.list) != null && I.length))
24
+ throw new Error("list is required when infinite is true");
25
+ const L = _, c = () => {
26
+ z(
27
+ r.value,
28
+ "transition-duration",
29
+ `${e.duration}ms`
30
+ ), m(e.direction, r.value, -s.value);
31
+ }, p = K({
32
+ name: t.name,
33
+ itemsInfo: [],
34
+ infinite: t.infinite
35
+ }), O = () => {
36
+ const n = b(J);
37
+ return j(t.name, n), n;
38
+ }, e = t.name !== M ? G(t.name) : O(), x = () => t.list.slice(e.currentIndex, e.currentIndex + 3), o = t.infinite ? w(x()) : null;
39
+ t.infinite && y(
40
+ () => t.list,
31
41
  () => {
32
- o.value = p();
42
+ o.value = x();
33
43
  },
34
44
  { once: !0 }
35
- ), k(() => e.currentIndex, a);
36
- const r = N(), s = _(
45
+ ), y(() => e.currentIndex, c);
46
+ const r = w(), s = g(
37
47
  () => (
38
48
  // 通过收集所有 slide-item 的宽和高, 叠加计算
39
- x.itemsInfo.slice(0, e.currentIndex).reduce((t, i) => (t += i[e.direction === v.HORIZONTAL ? "width" : "height"], t), 0)
49
+ p.itemsInfo.slice(0, e.currentIndex).reduce((n, i) => (n += i[e.direction === v.HORIZONTAL ? "width" : "height"], n), 0)
40
50
  )
41
- ), D = _(
42
- () => e.currentIndex === 0 && !e.isNext || e.currentIndex === x.itemsInfo.length - 1 && e.isNext
51
+ ), P = g(
52
+ () => e.currentIndex === 0 && !e.isNext || e.currentIndex === p.itemsInfo.length - 1 && e.isNext
43
53
  ), l = { x: 0, y: 0 };
44
- let u = !1;
45
- const L = (t) => {
46
- u = !0, l.x = t.pageX, l.y = t.pageY;
47
- }, { isConsistent: M, checkDirectionConsistent: P, resetCheckDirection: C } = z(e.direction), E = (t) => {
48
- if (!u) return;
49
- const i = t.pageX - l.x, I = t.pageY - l.y, d = e.direction === v.HORIZONTAL ? i : I;
50
- e.isNext = d < 0, !D.value && (P(i, I), M.value && (j(r.value), m(
54
+ let a = !1;
55
+ const D = (n) => {
56
+ a = !0, l.x = n.pageX, l.y = n.pageY;
57
+ }, { isConsistent: E, checkDirectionConsistent: C, resetCheckDirection: R } = U(e.direction), T = (n) => {
58
+ if (!a) return;
59
+ const i = n.pageX - l.x, N = n.pageY - l.y, u = e.direction === v.HORIZONTAL ? i : N;
60
+ e.isNext = u < 0, !P.value && (C(i, N), E.value && (F(r.value), m(
51
61
  e.direction,
52
62
  r.value,
53
- Math.min(-s.value + d, e.isNext ? -s.value : 0)
54
- ), e.shouldNext = Math.abs(d) > e.judgeValue));
63
+ Math.min(-s.value + u, e.isNext ? -s.value : 0)
64
+ ), e.shouldNext = Math.abs(u) > e.judgeValue));
55
65
  }, h = () => {
56
- e.shouldNext = !1, u = !1, C();
57
- }, R = () => {
66
+ e.shouldNext = !1, a = !1, R();
67
+ }, A = () => t.infinite ? e.currentIndex === o.value.length - 1 : !1, B = () => {
58
68
  if (!e.shouldNext)
59
- return a(), h();
60
- e.currentIndex += e.isNext ? 1 : -1, a(), w("switch", {
69
+ return c(), h();
70
+ e.currentIndex += e.isNext ? 1 : -1, c();
71
+ const n = {
61
72
  index: e.currentIndex
62
- }), h(), e.infinite && e.currentIndex === o.value.length - 1 && Y(async () => {
63
- var i;
64
- (o == null ? void 0 : o.value.length) === n.list.length && await ((i = n.loadMore) == null ? void 0 : i.call(n));
65
- const t = n.list[e.currentIndex + 1];
66
- t && o.value.push(t);
73
+ };
74
+ t.infinite && (n.item = t.list[e.currentIndex]), L("switch", n), h(), A() && q(async () => {
75
+ (o == null ? void 0 : o.value.length) === t.list.length && t.loadMore && await t.loadMore();
76
+ const i = t.list[e.currentIndex + 1];
77
+ i && o.value.push(i);
67
78
  });
68
79
  };
69
80
  return V(() => {
70
81
  m(e.direction, r.value, -s.value);
71
- }), (t, i) => ($(), Z(
82
+ }), (n, i) => ($(), Z(
72
83
  "div",
73
84
  {
74
85
  class: "loickit-slide",
75
86
  id: "loickit-slide",
76
- onPointerdown: f(L, ["prevent"]),
77
- onPointermove: f(E, ["prevent"]),
78
- onPointerup: f(R, ["prevent"])
87
+ onPointerdown: d(D, ["prevent"]),
88
+ onPointermove: d(T, ["prevent"]),
89
+ onPointerup: d(B, ["prevent"])
79
90
  },
80
91
  [
81
- B(
92
+ X(
82
93
  "div",
83
94
  {
84
95
  class: "loickit-slide-list",
85
- style: X({
96
+ style: Y({
86
97
  // 根据方向设置 flex-direction
87
- flexDirection: c(e).direction === c(v).HORIZONTAL ? "row" : "column"
98
+ flexDirection: f(e).direction === f(v).HORIZONTAL ? "row" : "column"
88
99
  }),
89
100
  ref_key: "slideListRef",
90
101
  ref: r
91
102
  },
92
103
  [
93
- c(e).infinite ? y(t.$slots, "default", {
104
+ t.infinite ? k(n.$slots, "default", {
94
105
  key: 1,
95
- cacheList: c(o)
96
- }) : y(t.$slots, "default", { key: 0 })
106
+ cacheList: f(o)
107
+ }) : k(n.$slots, "default", { key: 0 })
97
108
  ],
98
109
  4
99
110
  /* STYLE */
@@ -105,5 +116,5 @@ const oe = /* @__PURE__ */ T({
105
116
  }
106
117
  });
107
118
  export {
108
- oe as default
119
+ le as default
109
120
  };
@@ -1,7 +1,7 @@
1
1
  import { createProvide as e } from "../../utils/createProvide.js";
2
2
  import { SLIDE_PROVIDE_KEY as r } from "../constant/private.js";
3
- const [o, P] = e(r);
3
+ const [o, a] = e(r);
4
4
  export {
5
- o as useSlidePrivateProvide,
6
- P as useSlidePrivateState
5
+ o as createSlidePrivateProvide,
6
+ a as useSlidePrivateState
7
7
  };
@@ -1,45 +1,52 @@
1
- import { defineComponent as f, ref as l, watch as c, onMounted as m, onBeforeUnmount as p, createElementBlock as u, openBlock as x, createElementVNode as I, renderSlot as h } from "vue";
2
- import { useSlideState as v } from "../Provide/index.js";
3
- import { useSlidePrivateState as S } from "../Slide/provide.js";
4
- const R = /* @__PURE__ */ f({
1
+ import { defineComponent as a, ref as l, watch as c, onMounted as m, onBeforeUnmount as p, createElementBlock as u, openBlock as h, createElementVNode as x, renderSlot as v } from "vue";
2
+ import { useSlideState as I } from "../Provide/index.js";
3
+ import { useSlidePrivateState as w } from "../Slide/provide.js";
4
+ const C = /* @__PURE__ */ a({
5
5
  name: "LSlideItem",
6
6
  __name: "index",
7
7
  props: {
8
- index: { default: 0 }
8
+ index: {}
9
9
  },
10
- setup(a) {
11
- const o = a, t = S(), n = v(t.name), r = l(), s = l();
12
- n.infinite && c(
13
- () => n.currentIndex,
14
- () => {
15
- var e;
16
- n.currentIndex <= o.index + 1 && n.currentIndex >= o.index - 1 ? (e = r.value) == null || e.appendChild(
17
- t.itemsInfo[o.index].el
18
- ) : s.value.remove();
19
- }
20
- );
21
- const i = {
22
- index: o.index
10
+ setup(f) {
11
+ const i = f, e = w(), r = I(e.name), o = l(), s = l();
12
+ if (e.infinite) {
13
+ if (typeof i.index != "number")
14
+ throw new Error(
15
+ `index is required when infinite is true
16
+ please use the second parameter of the "v-for" directive`
17
+ );
18
+ c(
19
+ () => r.currentIndex,
20
+ () => {
21
+ var t;
22
+ r.currentIndex <= i.index + 1 && r.currentIndex >= i.index - 1 ? (t = o.value) == null || t.appendChild(
23
+ e.itemsInfo[i.index].el
24
+ ) : s.value.remove();
25
+ }
26
+ );
27
+ }
28
+ const n = {
29
+ index: i.index
23
30
  };
24
31
  return m(() => {
25
32
  var d;
26
- const e = (d = r.value) == null ? void 0 : d.getBoundingClientRect();
27
- i.width = e.width, i.height = e.height, n.infinite && (i.el = s.value), t.itemsInfo.push(i);
33
+ const t = (d = o.value) == null ? void 0 : d.getBoundingClientRect();
34
+ n.width = t.width, n.height = t.height, e.infinite && (n.el = s.value), e.itemsInfo.push(n);
28
35
  }), p(() => {
29
- t.itemsInfo.splice(
30
- t.itemsInfo.indexOf(i),
36
+ e.itemsInfo.splice(
37
+ e.itemsInfo.indexOf(n),
31
38
  1
32
39
  );
33
- }), (e, d) => (x(), u(
40
+ }), (t, d) => (h(), u(
34
41
  "div",
35
42
  {
36
43
  ref_key: "slideItemRef",
37
- ref: r,
44
+ ref: o,
38
45
  class: "loickit-slide-item",
39
46
  style: { position: "relative" }
40
47
  },
41
48
  [
42
- I(
49
+ x(
43
50
  "div",
44
51
  {
45
52
  ref_key: "slideItemContentWrapperRef",
@@ -47,7 +54,7 @@ const R = /* @__PURE__ */ f({
47
54
  class: "loickit-slide-item-content-wrapper"
48
55
  },
49
56
  [
50
- h(e.$slots, "default")
57
+ v(t.$slots, "default")
51
58
  ],
52
59
  512
53
60
  /* NEED_PATCH */
@@ -59,5 +66,5 @@ const R = /* @__PURE__ */ f({
59
66
  }
60
67
  });
61
68
  export {
62
- R as default
69
+ C as default
63
70
  };
@@ -1,4 +1,4 @@
1
- export declare const LSlide: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: {
1
+ export declare const LSlide: <T = any>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: {
2
2
  attrs: any;
3
3
  emit: (e: "switch", value: import("../types/index.js").SlideSwitchEvent) => void;
4
4
  slots: {
@@ -10,8 +10,9 @@ export declare const LSlide: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_s
10
10
  props: {
11
11
  readonly onSwitch?: ((value: import("../types/index.js").SlideSwitchEvent) => any) | undefined;
12
12
  name?: import("../types/private.js").SlideNameType | undefined;
13
+ infinite?: boolean | undefined;
13
14
  list?: T[] | undefined;
14
- loadMore?: (() => Promise<T>) | undefined;
15
+ loadMore?: (() => any) | undefined;
15
16
  } & import("vue").PublicProps;
16
17
  expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
17
18
  attrs: any;
@@ -1,12 +1,13 @@
1
1
  import type { SlideNameType } from '../types/private';
2
2
  import type { SlideSwitchEvent } from '../types';
3
- declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
+ declare const _default: <T = any>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
4
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
5
5
  readonly onSwitch?: ((value: SlideSwitchEvent) => any) | undefined;
6
6
  } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onSwitch"> & {
7
7
  name?: SlideNameType;
8
+ infinite?: boolean;
8
9
  list?: T[];
9
- loadMore?: () => Promise<T>;
10
+ loadMore?: () => any;
10
11
  } & Partial<{}>> & import("vue").PublicProps;
11
12
  expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
12
13
  attrs: any;
@@ -2,8 +2,9 @@ import { SlideItemInfo, SlideNameType } from '../types/private';
2
2
  type SlidePrivateState = {
3
3
  name: SlideNameType;
4
4
  itemsInfo: SlideItemInfo[];
5
+ infinite: boolean;
5
6
  };
6
- export declare const useSlidePrivateProvide: (state: SlidePrivateState) => {
7
+ export declare const createSlidePrivateProvide: (state: SlidePrivateState) => {
7
8
  name: SlideNameType;
8
9
  itemsInfo: {
9
10
  height: number;
@@ -11,5 +12,6 @@ export declare const useSlidePrivateProvide: (state: SlidePrivateState) => {
11
12
  index: import("../types/private").SlideItemInfoNameType;
12
13
  el?: HTMLElement | undefined;
13
14
  }[];
15
+ infinite: boolean;
14
16
  }, useSlidePrivateState: () => SlidePrivateState;
15
17
  export {};
@@ -1,9 +1,7 @@
1
1
  export declare const LSlideItem: {
2
2
  new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<{
3
3
  index?: number;
4
- }> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
5
- index: number;
6
- }, false, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
4
+ }> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {}, false, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
7
5
  P: {};
8
6
  B: {};
9
7
  D: {};
@@ -12,17 +10,13 @@ export declare const LSlideItem: {
12
10
  Defaults: {};
13
11
  }, Readonly<{
14
12
  index?: number;
15
- }> & Readonly<{}>, {}, {}, {}, {}, {
16
- index: number;
17
- }>;
13
+ }> & Readonly<{}>, {}, {}, {}, {}, {}>;
18
14
  __isFragment?: never;
19
15
  __isTeleport?: never;
20
16
  __isSuspense?: never;
21
17
  } & import("vue").ComponentOptionsBase<Readonly<{
22
18
  index?: number;
23
- }> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
24
- index: number;
25
- }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
19
+ }> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
26
20
  $slots: {
27
21
  default?: ((props: {}) => any) | undefined;
28
22
  };
@@ -11,12 +11,8 @@ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$
11
11
  declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
12
12
  slideItemRef: typeof slideItemRef;
13
13
  slideItemContentWrapperRef: typeof slideItemContentWrapperRef;
14
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
15
- index: number;
16
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
- declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
18
- index: number;
19
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
+ declare const __VLS_component: 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>;
20
16
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
21
17
  export default _default;
22
18
  type __VLS_WithSlots<T, S> = T & {
@@ -6,8 +6,8 @@ export type SlideState = {
6
6
  currentIndex: number;
7
7
  shouldNext: boolean;
8
8
  isNext: boolean;
9
- infinite?: boolean;
10
9
  };
11
10
  export type SlideSwitchEvent = {
12
11
  index: number;
12
+ item?: any;
13
13
  };
@@ -8,7 +8,6 @@ export declare const defineSlide: (provideKey: SlideNameType) => readonly [(init
8
8
  currentIndex: number;
9
9
  shouldNext: boolean;
10
10
  isNext: boolean;
11
- infinite?: boolean | undefined;
12
11
  };
13
12
  name: symbol;
14
13
  }, () => SlideState];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loickit-v/swiper",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "loickit swiper components for vue",
5
5
  "type": "module",
6
6
  "types": "./dist/types/index.d.ts",