@loickit-v/swiper 0.0.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.
Files changed (41) hide show
  1. package/README.md +1 -0
  2. package/dist/components/Provide/index.js +5 -0
  3. package/dist/components/Slide/index.js +6 -0
  4. package/dist/components/Slide/index.vue.js +109 -0
  5. package/dist/components/Slide/index.vue3.js +5 -0
  6. package/dist/components/Slide/provide.js +7 -0
  7. package/dist/components/SlideItem/index.js +6 -0
  8. package/dist/components/SlideItem/index.vue.js +63 -0
  9. package/dist/components/SlideItem/index.vue3.js +5 -0
  10. package/dist/components/constant/index.js +4 -0
  11. package/dist/components/constant/private.js +5 -0
  12. package/dist/hooks/defineSlide/default.js +12 -0
  13. package/dist/hooks/defineSlide/index.js +16 -0
  14. package/dist/index.css +1 -0
  15. package/dist/index.js +12 -0
  16. package/dist/tools/index.js +7 -0
  17. package/dist/types/components/Provide/index.d.ts +3 -0
  18. package/dist/types/components/Slide/index.d.ts +26 -0
  19. package/dist/types/components/Slide/index.vue.d.ts +25 -0
  20. package/dist/types/components/Slide/provide.d.ts +15 -0
  21. package/dist/types/components/SlideItem/index.d.ts +29 -0
  22. package/dist/types/components/SlideItem/index.vue.d.ts +26 -0
  23. package/dist/types/components/constant/index.d.ts +4 -0
  24. package/dist/types/components/constant/private.d.ts +2 -0
  25. package/dist/types/components/types/index.d.ts +13 -0
  26. package/dist/types/components/types/private.d.ts +8 -0
  27. package/dist/types/directive/dbl.d.ts +3 -0
  28. package/dist/types/directive/index.d.ts +1 -0
  29. package/dist/types/hooks/defineSlide/default.d.ts +2 -0
  30. package/dist/types/hooks/defineSlide/index.d.ts +14 -0
  31. package/dist/types/hooks/index.d.ts +1 -0
  32. package/dist/types/index.d.ts +6 -0
  33. package/dist/types/tools/index.d.ts +1 -0
  34. package/dist/types/utils/createProvide.d.ts +1 -0
  35. package/dist/types/utils/index.d.ts +8 -0
  36. package/dist/types/utils/slide.d.ts +8 -0
  37. package/dist/utils/createProvide.js +8 -0
  38. package/dist/utils/index.js +25 -0
  39. package/dist/utils/slide.js +21 -0
  40. package/dist/vendor/node_modules/.pnpm/@likcheung_shared@0.0.7/node_modules/@likcheung/shared/dist/index.js +6 -0
  41. package/package.json +43 -0
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # @loickit-v/swiper
@@ -0,0 +1,5 @@
1
+ import { inject as e } from "vue";
2
+ const o = (t) => e(t);
3
+ export {
4
+ o as useSlideState
5
+ };
@@ -0,0 +1,6 @@
1
+ import o from "./index.vue.js";
2
+ /* empty css */
3
+ const r = o;
4
+ export {
5
+ r as LSlide
6
+ };
@@ -0,0 +1,109 @@
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 a, renderSlot as y, nextTick as Y } from "vue";
2
+ import { u_setStyle as b } from "../../vendor/node_modules/.pnpm/@likcheung_shared@0.0.7/node_modules/@likcheung/shared/dist/index.js";
3
+ import { u_setTransform as m, u_setFlush as j } from "../../utils/index.js";
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({
11
+ name: "LSlide",
12
+ __name: "index",
13
+ props: {
14
+ name: { default: O },
15
+ list: { default: () => [] },
16
+ loadMore: {}
17
+ },
18
+ emits: ["switch"],
19
+ setup(S, { emit: g }) {
20
+ const n = S, w = g, c = () => {
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,
31
+ () => {
32
+ o.value = p();
33
+ },
34
+ { once: !0 }
35
+ ), k(() => e.currentIndex, c);
36
+ const r = N(), s = _(
37
+ () => (
38
+ // 通过收集所有 slide-item 的宽和高, 叠加计算
39
+ x.itemsInfo.slice(0, e.currentIndex).reduce((t, i) => (t += i[e.direction === v.HORIZONTAL ? "width" : "height"], t), 0)
40
+ )
41
+ ), D = _(
42
+ () => e.currentIndex === 0 && !e.isNext || e.currentIndex === x.itemsInfo.length - 1 && e.isNext
43
+ ), 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(
51
+ e.direction,
52
+ r.value,
53
+ Math.min(-s.value + d, e.isNext ? -s.value : 0)
54
+ ), e.shouldNext = Math.abs(d) > e.judgeValue));
55
+ }, h = () => {
56
+ e.shouldNext = !1, u = !1, C();
57
+ }, R = () => {
58
+ if (!e.shouldNext)
59
+ return c(), h();
60
+ e.currentIndex += e.isNext ? 1 : -1, c(), w("switch", {
61
+ 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);
67
+ });
68
+ };
69
+ return V(() => {
70
+ m(e.direction, r.value, -s.value);
71
+ }), (t, i) => ($(), Z(
72
+ "div",
73
+ {
74
+ class: "lik-slide",
75
+ id: "lik-slide",
76
+ onPointerdown: f(L, ["prevent"]),
77
+ onPointermove: f(E, ["prevent"]),
78
+ onPointerup: f(R, ["prevent"])
79
+ },
80
+ [
81
+ B(
82
+ "div",
83
+ {
84
+ class: "lik-slide-list",
85
+ style: X({
86
+ // 根据方向设置 flex-direction
87
+ flexDirection: a(e).direction === a(v).HORIZONTAL ? "row" : "column"
88
+ }),
89
+ ref_key: "slideListRef",
90
+ ref: r
91
+ },
92
+ [
93
+ a(e).infinite ? y(t.$slots, "default", {
94
+ key: 1,
95
+ cacheList: a(o)
96
+ }) : y(t.$slots, "default", { key: 0 })
97
+ ],
98
+ 4
99
+ /* STYLE */
100
+ )
101
+ ],
102
+ 32
103
+ /* NEED_HYDRATION */
104
+ ));
105
+ }
106
+ });
107
+ export {
108
+ oe as default
109
+ };
@@ -0,0 +1,5 @@
1
+ import o from "./index.vue.js";
2
+ /* empty css */
3
+ export {
4
+ o as default
5
+ };
@@ -0,0 +1,7 @@
1
+ import { createProvide as e } from "../../utils/createProvide.js";
2
+ import { SLIDE_PROVIDE_KEY as r } from "../constant/private.js";
3
+ const [o, P] = e(r);
4
+ export {
5
+ o as useSlidePrivateProvide,
6
+ P as useSlidePrivateState
7
+ };
@@ -0,0 +1,6 @@
1
+ import m from "./index.vue.js";
2
+ /* empty css */
3
+ const i = m;
4
+ export {
5
+ i as LSlideItem
6
+ };
@@ -0,0 +1,63 @@
1
+ import { defineComponent as f, ref as l, watch as m, onMounted as c, 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({
5
+ name: "LSlideItem",
6
+ __name: "index",
7
+ props: {
8
+ index: { default: 0 }
9
+ },
10
+ setup(a) {
11
+ const o = a, t = S(), n = v(t.name), r = l(), s = l();
12
+ n.infinite && m(
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
23
+ };
24
+ return c(() => {
25
+ 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);
28
+ }), p(() => {
29
+ t.itemsInfo.splice(
30
+ t.itemsInfo.indexOf(i),
31
+ 1
32
+ );
33
+ }), (e, d) => (x(), u(
34
+ "div",
35
+ {
36
+ ref_key: "slideItemRef",
37
+ ref: r,
38
+ class: "lik-slide-item",
39
+ style: { position: "relative" }
40
+ },
41
+ [
42
+ I(
43
+ "div",
44
+ {
45
+ ref_key: "slideItemContentWrapperRef",
46
+ ref: s,
47
+ class: "lik-slide-item-content-wrapper"
48
+ },
49
+ [
50
+ h(e.$slots, "default")
51
+ ],
52
+ 512
53
+ /* NEED_PATCH */
54
+ )
55
+ ],
56
+ 512
57
+ /* NEED_PATCH */
58
+ ));
59
+ }
60
+ });
61
+ export {
62
+ R as default
63
+ };
@@ -0,0 +1,5 @@
1
+ import o from "./index.vue.js";
2
+ /* empty css */
3
+ export {
4
+ o as default
5
+ };
@@ -0,0 +1,4 @@
1
+ var A = /* @__PURE__ */ ((r) => (r[r.VERTICAL = 0] = "VERTICAL", r[r.HORIZONTAL = 1] = "HORIZONTAL", r))(A || {});
2
+ export {
3
+ A as SLIDE_DIRECTION
4
+ };
@@ -0,0 +1,5 @@
1
+ const _ = Symbol("__L_SLIDE_PROVIDE__"), E = Symbol("__L_SLIDEPROVIDE__");
2
+ export {
3
+ E as COMMON_SLIDE_PROVIDE_NAME,
4
+ _ as SLIDE_PROVIDE_KEY
5
+ };
@@ -0,0 +1,12 @@
1
+ import { SLIDE_DIRECTION as e } from "../../components/constant/index.js";
2
+ const o = {
3
+ direction: e.HORIZONTAL,
4
+ currentIndex: 0,
5
+ shouldNext: !1,
6
+ isNext: !1,
7
+ duration: 300,
8
+ judgeValue: 20
9
+ };
10
+ export {
11
+ o as defaultState
12
+ };
@@ -0,0 +1,16 @@
1
+ import { reactive as i, provide as s, inject as a } from "vue";
2
+ import { defaultState as c } from "./default.js";
3
+ const u = (t) => {
4
+ const e = typeof t == "symbol" ? t : Symbol(t);
5
+ return [(o = {}) => {
6
+ const r = Object.assign(
7
+ { name: t },
8
+ c,
9
+ o
10
+ ), n = i(window.structuredClone(r));
11
+ return s(e, n), { state: n, name: e };
12
+ }, () => a(e)];
13
+ };
14
+ export {
15
+ u as defineSlide
16
+ };
package/dist/index.css ADDED
@@ -0,0 +1 @@
1
+ .lik-slide{touch-action:none;height:100%;width:100%;transition:height .3s;position:relative;overflow:hidden}.lik-slide-list{height:100%;width:100%;display:flex;position:relative}.lik-slide-item{height:100%;width:100%;flex-shrink:0;overflow:hidden}.lik-slide-item-content-wrapper{height:100%;width:100%}
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ import { SLIDE_DIRECTION as r } from "./components/constant/index.js";
2
+ import { LSlide as f } from "./components/Slide/index.js";
3
+ import { LSlideItem as p } from "./components/SlideItem/index.js";
4
+ import { defineSlide as d } from "./hooks/defineSlide/index.js";
5
+ import { t_panTouch as I } from "./tools/index.js";
6
+ export {
7
+ f as LSlide,
8
+ p as LSlideItem,
9
+ r as SLIDE_DIRECTION,
10
+ d as defineSlide,
11
+ I as t_panTouch
12
+ };
@@ -0,0 +1,7 @@
1
+ import { u_stop as t } from "../utils/index.js";
2
+ const r = (e) => (e.addEventListener("pointerdown", t), e.addEventListener("pointermove", t), e.addEventListener("pointerup", t), e.addEventListener("touchstart", t), e.addEventListener("touchmove", t), e.addEventListener("touchend", t), () => {
3
+ e.removeEventListener("pointerdown", t), e.removeEventListener("pointermove", t), e.removeEventListener("pointerup", t), e.removeEventListener("touchstart", t), e.removeEventListener("touchmove", t), e.removeEventListener("touchend", t);
4
+ });
5
+ export {
6
+ r as t_panTouch
7
+ };
@@ -0,0 +1,3 @@
1
+ import type { SlideState } from '../types';
2
+ import type { SlideNameType } from '../types/private';
3
+ export declare const useSlideState: (providerKey: SlideNameType) => SlideState;
@@ -0,0 +1,26 @@
1
+ export declare const LSlide: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: {
2
+ attrs: any;
3
+ emit: (e: "switch", value: import("../types/index.js").SlideSwitchEvent) => void;
4
+ slots: {
5
+ default?: (((props: {}) => any) & ((props: {
6
+ cacheList: import("@vue/reactivity").UnwrapRefSimple<T>[] | null;
7
+ }) => any)) | undefined;
8
+ };
9
+ }, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
10
+ props: {
11
+ readonly onSwitch?: ((value: import("../types/index.js").SlideSwitchEvent) => any) | undefined;
12
+ name?: import("../types/private.js").SlideNameType | undefined;
13
+ list?: T[] | undefined;
14
+ loadMore?: (() => Promise<T>) | undefined;
15
+ } & import("vue").PublicProps;
16
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
17
+ attrs: any;
18
+ slots: {
19
+ default?: (((props: {}) => any) & ((props: {
20
+ cacheList: import("@vue/reactivity").UnwrapRefSimple<T>[] | null;
21
+ }) => any)) | undefined;
22
+ };
23
+ emit: (e: "switch", value: import("../types/index.js").SlideSwitchEvent) => void;
24
+ }>) => import("vue").VNode & {
25
+ __ctx?: Awaited<typeof __VLS_setup>;
26
+ };
@@ -0,0 +1,25 @@
1
+ import type { SlideNameType } from '../types/private';
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<{
4
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
5
+ readonly onSwitch?: ((value: SlideSwitchEvent) => any) | undefined;
6
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onSwitch"> & {
7
+ name?: SlideNameType;
8
+ list?: T[];
9
+ loadMore?: () => Promise<T>;
10
+ } & Partial<{}>> & import("vue").PublicProps;
11
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
12
+ attrs: any;
13
+ slots: {
14
+ default?: (((props: {}) => any) & ((props: {
15
+ cacheList: import("@vue/reactivity").UnwrapRefSimple<T>[] | null;
16
+ }) => any)) | undefined;
17
+ };
18
+ emit: (e: "switch", value: SlideSwitchEvent) => void;
19
+ }>) => import("vue").VNode & {
20
+ __ctx?: Awaited<typeof __VLS_setup>;
21
+ };
22
+ export default _default;
23
+ type __VLS_PrettifyLocal<T> = {
24
+ [K in keyof T]: T[K];
25
+ } & {};
@@ -0,0 +1,15 @@
1
+ import { SlideItemInfo, SlideNameType } from '../types/private';
2
+ type SlidePrivateState = {
3
+ name: SlideNameType;
4
+ itemsInfo: SlideItemInfo[];
5
+ };
6
+ export declare const useSlidePrivateProvide: (state: SlidePrivateState) => {
7
+ name: SlideNameType;
8
+ itemsInfo: {
9
+ height: number;
10
+ width: number;
11
+ index: import("../types/private").SlideItemInfoNameType;
12
+ el?: HTMLElement | undefined;
13
+ }[];
14
+ }, useSlidePrivateState: () => SlidePrivateState;
15
+ export {};
@@ -0,0 +1,29 @@
1
+ export declare const LSlideItem: {
2
+ new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<{
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, {
7
+ P: {};
8
+ B: {};
9
+ D: {};
10
+ C: {};
11
+ M: {};
12
+ Defaults: {};
13
+ }, Readonly<{
14
+ index?: number;
15
+ }> & Readonly<{}>, {}, {}, {}, {}, {
16
+ index: number;
17
+ }>;
18
+ __isFragment?: never;
19
+ __isTeleport?: never;
20
+ __isSuspense?: never;
21
+ } & import("vue").ComponentOptionsBase<Readonly<{
22
+ 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 () => {
26
+ $slots: {
27
+ default?: ((props: {}) => any) | undefined;
28
+ };
29
+ });
@@ -0,0 +1,26 @@
1
+ type __VLS_Props = {
2
+ index?: number;
3
+ };
4
+ declare const slideItemRef: import("vue").Ref<HTMLDivElement | undefined, HTMLDivElement | undefined>;
5
+ declare const slideItemContentWrapperRef: import("vue").Ref<HTMLDivElement | undefined, HTMLDivElement | undefined>;
6
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
7
+ declare var __VLS_1: {};
8
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
9
+ default?: (props: typeof __VLS_1) => any;
10
+ }>;
11
+ declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
12
+ slideItemRef: typeof slideItemRef;
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>;
20
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
21
+ export default _default;
22
+ type __VLS_WithSlots<T, S> = T & {
23
+ new (): {
24
+ $slots: S;
25
+ };
26
+ };
@@ -0,0 +1,4 @@
1
+ export declare enum SLIDE_DIRECTION {
2
+ VERTICAL = 0,
3
+ HORIZONTAL = 1
4
+ }
@@ -0,0 +1,2 @@
1
+ export declare const SLIDE_PROVIDE_KEY: unique symbol;
2
+ export declare const COMMON_SLIDE_PROVIDE_NAME: unique symbol;
@@ -0,0 +1,13 @@
1
+ import type { SLIDE_DIRECTION } from '../constant';
2
+ export type SlideState = {
3
+ judgeValue: number;
4
+ duration: number;
5
+ direction: SLIDE_DIRECTION;
6
+ currentIndex: number;
7
+ shouldNext: boolean;
8
+ isNext: boolean;
9
+ infinite?: boolean;
10
+ };
11
+ export type SlideSwitchEvent = {
12
+ index: number;
13
+ };
@@ -0,0 +1,8 @@
1
+ export type SlideNameType = string | symbol;
2
+ export type SlideItemInfoNameType = SlideNameType | number;
3
+ export type SlideItemInfo = {
4
+ height: number;
5
+ width: number;
6
+ index: SlideItemInfoNameType;
7
+ el?: HTMLElement;
8
+ };
@@ -0,0 +1,3 @@
1
+ import type { Directive } from 'vue';
2
+ declare const vDbl: Directive;
3
+ export { vDbl };
@@ -0,0 +1 @@
1
+ export * from './dbl';
@@ -0,0 +1,2 @@
1
+ import type { SlideState } from '../../components/types';
2
+ export declare const defaultState: SlideState;
@@ -0,0 +1,14 @@
1
+ import type { SlideState } from '../../components/types';
2
+ import type { SlideNameType } from '../../components/types/private';
3
+ export declare const defineSlide: (provideKey: SlideNameType) => readonly [(initState?: Partial<Omit<SlideState, "itemsInfo">>) => {
4
+ state: {
5
+ judgeValue: number;
6
+ duration: number;
7
+ direction: import("../..").SLIDE_DIRECTION;
8
+ currentIndex: number;
9
+ shouldNext: boolean;
10
+ isNext: boolean;
11
+ infinite?: boolean | undefined;
12
+ };
13
+ name: symbol;
14
+ }, () => SlideState];
@@ -0,0 +1 @@
1
+ export * from './defineSlide';
@@ -0,0 +1,6 @@
1
+ export * from './components/types';
2
+ export * from './components/constant';
3
+ export * from './components/Slide';
4
+ export * from './components/SlideItem';
5
+ export * from './hooks';
6
+ export * from './tools';
@@ -0,0 +1 @@
1
+ export declare const t_panTouch: (el: Element) => (() => void);
@@ -0,0 +1 @@
1
+ export declare const createProvide: <T extends object = any>(key: symbol | string) => readonly [(state: T) => import("vue").Reactive<T>, () => T];
@@ -0,0 +1,8 @@
1
+ import { SLIDE_DIRECTION } from '../components/constant';
2
+ export declare const u_setTransform: (direction: SLIDE_DIRECTION, el: HTMLElement, value: number) => void;
3
+ export declare const u_setFlush: (el: HTMLElement) => void;
4
+ export declare const u_once: (fn: (...args: any[]) => void) => {
5
+ run: (...args: any[]) => void;
6
+ reset: () => void;
7
+ };
8
+ export declare const u_stop: (e: Event) => void;
@@ -0,0 +1,8 @@
1
+ import { SLIDE_DIRECTION } from '../components/constant';
2
+ export declare const checkDirection: (slideDirection: SLIDE_DIRECTION) => {
3
+ isConsistent: {
4
+ value: boolean;
5
+ };
6
+ checkDirectionConsistent: (...args: any[]) => void;
7
+ resetCheckDirection: () => void;
8
+ };
@@ -0,0 +1,8 @@
1
+ import { reactive as o, provide as n, inject as c } from "vue";
2
+ const u = (e) => [(r) => {
3
+ const t = o(r);
4
+ return n(e, t), t;
5
+ }, () => c(e)];
6
+ export {
7
+ u as createProvide
8
+ };
@@ -0,0 +1,25 @@
1
+ import { SLIDE_DIRECTION as n } from "../components/constant/index.js";
2
+ import { u_setStyle as r } from "../vendor/node_modules/.pnpm/@likcheung_shared@0.0.7/node_modules/@likcheung/shared/dist/index.js";
3
+ const i = (t, o, s) => {
4
+ t === n.HORIZONTAL ? r(o, "transform", `translateX(${s}px)`) : r(o, "transform", `translateY(${s}px)`);
5
+ }, f = (t) => {
6
+ r(t, "transition-duration", "0ms");
7
+ }, u = (t) => {
8
+ let o = !1;
9
+ return {
10
+ run: function(...s) {
11
+ o || (o = !0, t(...s));
12
+ },
13
+ reset: function() {
14
+ o = !1;
15
+ }
16
+ };
17
+ }, m = (t) => {
18
+ t.stopPropagation(), t.stopImmediatePropagation();
19
+ };
20
+ export {
21
+ u as u_once,
22
+ f as u_setFlush,
23
+ i as u_setTransform,
24
+ m as u_stop
25
+ };
@@ -0,0 +1,21 @@
1
+ import { SLIDE_DIRECTION as i } from "../components/constant/index.js";
2
+ import { u_once as a } from "./index.js";
3
+ const D = (n) => {
4
+ let e = { value: !1 };
5
+ const { run: s, reset: c } = a(
6
+ (o, r) => {
7
+ const t = Math.abs(o) * 10 / (Math.abs(r) * 10 || 1);
8
+ e.value = n === i.HORIZONTAL ? t > 1 : t <= 1;
9
+ }
10
+ );
11
+ return {
12
+ isConsistent: e,
13
+ checkDirectionConsistent: s,
14
+ resetCheckDirection: () => {
15
+ c(), e.value = !1;
16
+ }
17
+ };
18
+ };
19
+ export {
20
+ D as checkDirection
21
+ };
@@ -0,0 +1,6 @@
1
+ const o = (s, r, t) => {
2
+ r === "transform" ? s.style.webkitTransform = s.style.MsTransform = s.style.msTransform = s.style.MozTransform = s.style.OTransform = s.style.transform = t : s.style[r] = t;
3
+ };
4
+ export {
5
+ o as u_setStyle
6
+ };
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@loickit-v/swiper",
3
+ "version": "0.0.1",
4
+ "description": "loickit swiper components for vue",
5
+ "type": "module",
6
+ "types": "./dist/types/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./dist/index.js",
10
+ "types": "./dist/types/index.d.ts"
11
+ },
12
+ "./style": {
13
+ "import": "./dist/index.css",
14
+ "types": "./dist/types/index.d.ts"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "keywords": [
21
+ "vue"
22
+ ],
23
+ "devDependencies": {
24
+ "@iconify/vue": "^4.3.0",
25
+ "@types/node": "^22.13.10",
26
+ "@vue/tsconfig": "^0.7.0",
27
+ "@loickit-v/cli": "^1.0.0"
28
+ },
29
+ "dependencies": {
30
+ "@likcheung/shared": "^0.0.7"
31
+ },
32
+ "peerDependencies": {
33
+ "vue": "^3.5.13"
34
+ },
35
+ "publishConfig": {
36
+ "access": "public"
37
+ },
38
+ "license": "UNLICENSED",
39
+ "author": "licheung228",
40
+ "scripts": {
41
+ "build": "loickit-cli build"
42
+ }
43
+ }