@loickit-v/swiper 0.0.5 → 0.0.6
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.
@@ -1,5 +1,5 @@
|
|
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
|
2
|
-
import { u_setStyle as b } from "
|
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
3
|
import { u_setTransform as m, u_setFlush as j } from "../../utils/index.js";
|
4
4
|
import { SLIDE_DIRECTION as v } from "../constant/index.js";
|
5
5
|
import { checkDirection as z } from "../../utils/slide.js";
|
@@ -17,7 +17,7 @@ const oe = /* @__PURE__ */ T({
|
|
17
17
|
},
|
18
18
|
emits: ["switch"],
|
19
19
|
setup(S, { emit: g }) {
|
20
|
-
const n = S, w = g,
|
20
|
+
const n = S, w = g, a = () => {
|
21
21
|
b(r.value, "transition-duration", `${e.duration}ms`), m(e.direction, r.value, -s.value);
|
22
22
|
}, x = q({
|
23
23
|
name: n.name,
|
@@ -32,7 +32,7 @@ const oe = /* @__PURE__ */ T({
|
|
32
32
|
o.value = p();
|
33
33
|
},
|
34
34
|
{ once: !0 }
|
35
|
-
), k(() => e.currentIndex,
|
35
|
+
), k(() => e.currentIndex, a);
|
36
36
|
const r = N(), s = _(
|
37
37
|
() => (
|
38
38
|
// 通过收集所有 slide-item 的宽和高, 叠加计算
|
@@ -56,8 +56,8 @@ const oe = /* @__PURE__ */ T({
|
|
56
56
|
e.shouldNext = !1, u = !1, C();
|
57
57
|
}, R = () => {
|
58
58
|
if (!e.shouldNext)
|
59
|
-
return
|
60
|
-
e.currentIndex += e.isNext ? 1 : -1,
|
59
|
+
return a(), h();
|
60
|
+
e.currentIndex += e.isNext ? 1 : -1, a(), w("switch", {
|
61
61
|
index: e.currentIndex
|
62
62
|
}), h(), e.infinite && e.currentIndex === o.value.length - 1 && Y(async () => {
|
63
63
|
var i;
|
@@ -71,8 +71,8 @@ const oe = /* @__PURE__ */ T({
|
|
71
71
|
}), (t, i) => ($(), Z(
|
72
72
|
"div",
|
73
73
|
{
|
74
|
-
class: "
|
75
|
-
id: "
|
74
|
+
class: "loickit-slide",
|
75
|
+
id: "loickit-slide",
|
76
76
|
onPointerdown: f(L, ["prevent"]),
|
77
77
|
onPointermove: f(E, ["prevent"]),
|
78
78
|
onPointerup: f(R, ["prevent"])
|
@@ -81,18 +81,18 @@ const oe = /* @__PURE__ */ T({
|
|
81
81
|
B(
|
82
82
|
"div",
|
83
83
|
{
|
84
|
-
class: "
|
84
|
+
class: "loickit-slide-list",
|
85
85
|
style: X({
|
86
86
|
// 根据方向设置 flex-direction
|
87
|
-
flexDirection:
|
87
|
+
flexDirection: c(e).direction === c(v).HORIZONTAL ? "row" : "column"
|
88
88
|
}),
|
89
89
|
ref_key: "slideListRef",
|
90
90
|
ref: r
|
91
91
|
},
|
92
92
|
[
|
93
|
-
|
93
|
+
c(e).infinite ? y(t.$slots, "default", {
|
94
94
|
key: 1,
|
95
|
-
cacheList:
|
95
|
+
cacheList: c(o)
|
96
96
|
}) : y(t.$slots, "default", { key: 0 })
|
97
97
|
],
|
98
98
|
4
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { defineComponent as f, ref as l, watch as
|
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
2
|
import { useSlideState as v } from "../Provide/index.js";
|
3
3
|
import { useSlidePrivateState as S } from "../Slide/provide.js";
|
4
4
|
const R = /* @__PURE__ */ f({
|
@@ -9,7 +9,7 @@ const R = /* @__PURE__ */ f({
|
|
9
9
|
},
|
10
10
|
setup(a) {
|
11
11
|
const o = a, t = S(), n = v(t.name), r = l(), s = l();
|
12
|
-
n.infinite &&
|
12
|
+
n.infinite && c(
|
13
13
|
() => n.currentIndex,
|
14
14
|
() => {
|
15
15
|
var e;
|
@@ -21,7 +21,7 @@ const R = /* @__PURE__ */ f({
|
|
21
21
|
const i = {
|
22
22
|
index: o.index
|
23
23
|
};
|
24
|
-
return
|
24
|
+
return m(() => {
|
25
25
|
var d;
|
26
26
|
const e = (d = r.value) == null ? void 0 : d.getBoundingClientRect();
|
27
27
|
i.width = e.width, i.height = e.height, n.infinite && (i.el = s.value), t.itemsInfo.push(i);
|
@@ -35,7 +35,7 @@ const R = /* @__PURE__ */ f({
|
|
35
35
|
{
|
36
36
|
ref_key: "slideItemRef",
|
37
37
|
ref: r,
|
38
|
-
class: "
|
38
|
+
class: "loickit-slide-item",
|
39
39
|
style: { position: "relative" }
|
40
40
|
},
|
41
41
|
[
|
@@ -44,7 +44,7 @@ const R = /* @__PURE__ */ f({
|
|
44
44
|
{
|
45
45
|
ref_key: "slideItemContentWrapperRef",
|
46
46
|
ref: s,
|
47
|
-
class: "
|
47
|
+
class: "loickit-slide-item-content-wrapper"
|
48
48
|
},
|
49
49
|
[
|
50
50
|
h(e.$slots, "default")
|
package/dist/index.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
.
|
1
|
+
.loickit-slide{touch-action:none;height:100%;width:100%;transition:height .3s;position:relative;overflow:hidden}.loickit-slide-list{height:100%;width:100%;display:flex;position:relative}.loickit-slide-item{height:100%;width:100%;flex-shrink:0;overflow:hidden}.loickit-slide-item-content-wrapper{height:100%;width:100%}
|
package/dist/utils/index.js
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
import { SLIDE_DIRECTION as n } from "../components/constant/index.js";
|
2
|
-
import { u_setStyle as
|
3
|
-
const i = (t, o,
|
4
|
-
t === n.HORIZONTAL ?
|
2
|
+
import { u_setStyle as s } from "@likcheung/shared";
|
3
|
+
const i = (t, o, r) => {
|
4
|
+
t === n.HORIZONTAL ? s(o, "transform", `translateX(${r}px)`) : s(o, "transform", `translateY(${r}px)`);
|
5
5
|
}, f = (t) => {
|
6
|
-
|
6
|
+
s(t, "transition-duration", "0ms");
|
7
7
|
}, u = (t) => {
|
8
8
|
let o = !1;
|
9
9
|
return {
|
10
|
-
run: function(...
|
11
|
-
o || (o = !0, t(...
|
10
|
+
run: function(...r) {
|
11
|
+
o || (o = !0, t(...r));
|
12
12
|
},
|
13
13
|
reset: function() {
|
14
14
|
o = !1;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@loickit-v/swiper",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.6",
|
4
4
|
"description": "loickit swiper components for vue",
|
5
5
|
"type": "module",
|
6
6
|
"types": "./dist/types/index.d.ts",
|
@@ -21,15 +21,15 @@
|
|
21
21
|
"vue"
|
22
22
|
],
|
23
23
|
"devDependencies": {
|
24
|
-
"@iconify/vue": "^4.3.0",
|
25
24
|
"@types/node": "^22.13.10",
|
26
25
|
"@vue/tsconfig": "^0.7.0"
|
27
26
|
},
|
28
27
|
"dependencies": {
|
29
|
-
"@likcheung/shared": "^0.0.7"
|
28
|
+
"@likcheung/shared": "^0.0.7",
|
29
|
+
"@iconify/vue": "^4.3.0"
|
30
30
|
},
|
31
31
|
"peerDependencies": {
|
32
|
-
"vue": "
|
32
|
+
"vue": ">=3.5.0"
|
33
33
|
},
|
34
34
|
"publishConfig": {
|
35
35
|
"access": "public"
|
@@ -37,6 +37,6 @@
|
|
37
37
|
"license": "MIT",
|
38
38
|
"author": "licheung228",
|
39
39
|
"scripts": {
|
40
|
-
"build": "loickit-cli build"
|
40
|
+
"build": "loickit-cli build:vue"
|
41
41
|
}
|
42
42
|
}
|