@squirkle-ui/swiper 0.0.0-stage → 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,319 @@
1
+ import { defineComponent, ref, computed, watch, onMounted, onBeforeUnmount, resolveComponent, openBlock, createElementBlock, withKeys, withModifiers, normalizeStyle, normalizeClass, createVNode, createElementVNode, Fragment, renderList, renderSlot, createCommentVNode, toDisplayString } from "vue";
2
+ import { getByPath } from "@squirkle-ui/core";
3
+ import { vModel, SqShape, SqBtn, useProxiedModel, radiusValue } from "@squirkle-ui/ui";
4
+ const _sfc_main = defineComponent({
5
+ name: "SqSwiper",
6
+ components: { SqBtn, SqShape },
7
+ model: vModel,
8
+ props: {
9
+ modelValue: { type: Number, default: 0 },
10
+ items: { type: Array, default: () => [] },
11
+ itemKey: { type: String, default: void 0 },
12
+ slidesPerView: { type: Number, default: 1 },
13
+ spaceBetween: { type: Number, default: 16 },
14
+ /** { 640: { slidesPerView: 2 }, 1024: { slidesPerView: 3 } } — keys are min container widths. */
15
+ breakpoints: { type: Object, default: void 0 },
16
+ effect: { type: String, default: "slide" },
17
+ loop: Boolean,
18
+ centered: Boolean,
19
+ vertical: Boolean,
20
+ /** Autoplay delay in ms; 0 disables. */
21
+ autoplay: { type: Number, default: 0 },
22
+ pauseOnHover: { type: Boolean, default: true },
23
+ speed: { type: Number, default: 420 },
24
+ navigation: { type: Boolean, default: true },
25
+ pagination: { type: [String, Boolean], default: "dots" },
26
+ height: { type: [Number, String], default: 320 },
27
+ rounded: { type: [String, Number], default: "xl" },
28
+ label: { type: String, default: "Carousel" }
29
+ },
30
+ emits: ["update:modelValue", "change"],
31
+ setup(props, { emit }) {
32
+ const model = useProxiedModel(props, emit);
33
+ const root = ref(null);
34
+ const size = ref(800);
35
+ const drag = ref(0);
36
+ const dragging = ref(false);
37
+ const hovering = ref(false);
38
+ const jumping = ref(/* @__PURE__ */ new Set());
39
+ const list = computed(() => props.items);
40
+ const n = computed(() => list.value.length);
41
+ const keyOf = (item, i) => props.itemKey ? getByPath(item, props.itemKey) : i;
42
+ const responsive = computed(() => {
43
+ let r = { slidesPerView: props.slidesPerView, spaceBetween: props.spaceBetween };
44
+ if (props.breakpoints) {
45
+ for (const bp of Object.keys(props.breakpoints).map(Number).sort((a, b) => a - b)) if (size.value >= bp) r = { ...r, ...props.breakpoints[bp] };
46
+ }
47
+ if (props.effect !== "slide") r = { ...r, slidesPerView: 1 };
48
+ return r;
49
+ });
50
+ const spv = computed(() => Math.max(1, Math.min(responsive.value.slidesPerView, n.value || 1)));
51
+ const slideSize = computed(() => (size.value - responsive.value.spaceBetween * (spv.value - 1)) / spv.value);
52
+ const step = computed(() => slideSize.value + responsive.value.spaceBetween);
53
+ const maxIndex = computed(() => props.loop || props.centered ? n.value - 1 : Math.max(0, n.value - spv.value));
54
+ const normIndex = computed(() => n.value ? (model.value % n.value + n.value) % n.value : 0);
55
+ const pageCount = computed(() => props.loop || props.centered ? n.value : maxIndex.value + 1);
56
+ const canPrev = computed(() => props.loop || normIndex.value > 0);
57
+ const canNext = computed(() => props.loop || normIndex.value < maxIndex.value);
58
+ const offsetOf = (i) => {
59
+ let o = i - normIndex.value;
60
+ if (props.loop && n.value > 1) {
61
+ const half = n.value / 2;
62
+ o = ((o + half) % n.value + n.value) % n.value - half;
63
+ }
64
+ return o;
65
+ };
66
+ const prevOffsets = /* @__PURE__ */ new Map();
67
+ watch(normIndex, () => {
68
+ const jumps = /* @__PURE__ */ new Set();
69
+ for (let i = 0; i < n.value; i++) {
70
+ const o = offsetOf(i);
71
+ const was = prevOffsets.get(i);
72
+ if (was != null && Math.abs(o - was) > 1.5) jumps.add(i);
73
+ prevOffsets.set(i, o);
74
+ }
75
+ jumping.value = jumps;
76
+ requestAnimationFrame(() => requestAnimationFrame(() => jumping.value = /* @__PURE__ */ new Set()));
77
+ emit("change", normIndex.value);
78
+ });
79
+ const isVisible = (i) => {
80
+ const o = offsetOf(i);
81
+ return props.centered ? Math.abs(o) <= spv.value / 2 : o >= 0 && o < spv.value;
82
+ };
83
+ const slideStyle = (i) => {
84
+ const o = offsetOf(i);
85
+ const dragFrac = drag.value / step.value;
86
+ const pos = o + dragFrac;
87
+ const center = props.centered ? (size.value - slideSize.value) / 2 : 0;
88
+ const axis = props.vertical ? "Y" : "X";
89
+ const s = { [props.vertical ? "height" : "width"]: `${slideSize.value}px`, transitionDuration: dragging.value ? "0ms" : `${props.speed}ms` };
90
+ if (props.effect === "fade") {
91
+ s.opacity = String(Math.max(0, 1 - Math.abs(pos)));
92
+ s.zIndex = String(o === 0 ? 2 : 1);
93
+ } else if (props.effect === "coverflow") {
94
+ const x = (size.value - slideSize.value) / 2 + pos * slideSize.value * 0.62;
95
+ s.transform = `translate${axis}(${x}px) perspective(900px) rotateY(${Math.max(-1, Math.min(1, pos)) * -42}deg) scale(${1 - Math.min(1, Math.abs(pos)) * 0.18})`;
96
+ s.zIndex = String(100 - Math.round(Math.abs(pos) * 10));
97
+ s.opacity = Math.abs(pos) > 2.5 ? "0" : "1";
98
+ } else if (props.effect === "cards") {
99
+ const p = Math.max(-1, pos);
100
+ s.transform = p < 0 ? `translateX(${p * size.value}px) rotate(${p * 8}deg)` : `translateY(${Math.min(p, 3) * 14}px) scale(${1 - Math.min(p, 3) * 0.06})`;
101
+ s.zIndex = String(100 - Math.round(Math.abs(pos) * 10));
102
+ s.opacity = pos > 3 ? "0" : "1";
103
+ } else s.transform = `translate${axis}(${center + pos * step.value}px)`;
104
+ return s;
105
+ };
106
+ const goTo = (i) => {
107
+ if (!n.value) return;
108
+ if (props.loop) {
109
+ const target = (i % n.value + n.value) % n.value;
110
+ model.value = model.value + offsetOfTarget(target);
111
+ } else model.value = Math.max(0, Math.min(maxIndex.value, i));
112
+ };
113
+ const offsetOfTarget = (target) => {
114
+ let d = target - normIndex.value;
115
+ const half = n.value / 2;
116
+ d = ((d + half) % n.value + n.value) % n.value - half;
117
+ return d;
118
+ };
119
+ const next = () => canNext.value ? props.loop ? model.value = model.value + 1 : goTo(normIndex.value + 1) : props.autoplay && goTo(0);
120
+ const prev = () => canPrev.value && (props.loop ? model.value = model.value - 1 : goTo(normIndex.value - 1));
121
+ let start = 0;
122
+ let startT = 0;
123
+ const onMove = (e) => {
124
+ const d = (props.vertical ? e.clientY : e.clientX) - start;
125
+ const edge = !props.loop && (normIndex.value === 0 && d > 0 || normIndex.value >= maxIndex.value && d < 0);
126
+ drag.value = edge ? d * 0.3 : d;
127
+ };
128
+ const onUp = () => {
129
+ window.removeEventListener("pointermove", onMove);
130
+ window.removeEventListener("pointerup", onUp);
131
+ const d = drag.value;
132
+ const fast = Math.abs(d) > 30 && Date.now() - startT < 250;
133
+ const steps = Math.round(-d / step.value) || (fast ? -Math.sign(d) : 0);
134
+ dragging.value = false;
135
+ drag.value = 0;
136
+ if (steps) props.loop ? model.value = model.value + steps : goTo(normIndex.value + steps);
137
+ };
138
+ const onDown = (e) => {
139
+ if (e.button !== 0 || e.target.closest("button, a, input")) return;
140
+ start = props.vertical ? e.clientY : e.clientX;
141
+ startT = Date.now();
142
+ dragging.value = true;
143
+ window.addEventListener("pointermove", onMove);
144
+ window.addEventListener("pointerup", onUp);
145
+ };
146
+ let timer;
147
+ const restart = () => {
148
+ clearInterval(timer);
149
+ if (props.autoplay > 0) timer = setInterval(() => !(props.pauseOnHover && hovering.value) && !dragging.value && !document.hidden && next(), props.autoplay);
150
+ };
151
+ watch(() => props.autoplay, restart);
152
+ let ro;
153
+ onMounted(() => {
154
+ const measure = () => root.value && (size.value = props.vertical ? root.value.clientHeight : root.value.clientWidth);
155
+ measure();
156
+ if (typeof ResizeObserver !== "undefined" && root.value) {
157
+ ro = new ResizeObserver(measure);
158
+ ro.observe(root.value);
159
+ }
160
+ for (let i = 0; i < n.value; i++) prevOffsets.set(i, offsetOf(i));
161
+ restart();
162
+ });
163
+ onBeforeUnmount(() => {
164
+ clearInterval(timer);
165
+ ro?.disconnect();
166
+ onUp();
167
+ });
168
+ const rootStyle = computed(() => ({ height: typeof props.height === "number" ? `${props.height}px` : props.height, "--sq-r": radiusValue(props.rounded), "--sq-bg": "var(--sq-surface-variant)" }));
169
+ return { root, list, keyOf, normIndex, pageCount, canPrev, canNext, slideStyle, isVisible, goTo, next, prev, onDown, dragging, hovering, jumping, rootStyle };
170
+ }
171
+ });
172
+ const _export_sfc = (sfc, props) => {
173
+ const target = sfc.__vccOpts || sfc;
174
+ for (const [key, val] of props) {
175
+ target[key] = val;
176
+ }
177
+ return target;
178
+ };
179
+ const _hoisted_1 = ["aria-label"];
180
+ const _hoisted_2 = ["aria-label", "aria-hidden"];
181
+ const _hoisted_3 = {
182
+ key: 1,
183
+ class: "sq-swiper__dots"
184
+ };
185
+ const _hoisted_4 = ["aria-label", "onClick"];
186
+ const _hoisted_5 = {
187
+ key: 2,
188
+ class: "sq-swiper__fraction"
189
+ };
190
+ const _hoisted_6 = {
191
+ key: 3,
192
+ class: "sq-swiper__progress"
193
+ };
194
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
195
+ const _component_SqShape = resolveComponent("SqShape");
196
+ const _component_SqBtn = resolveComponent("SqBtn");
197
+ return openBlock(), createElementBlock("div", {
198
+ ref: "root",
199
+ class: normalizeClass(["sq-swiper sq-surface", [`sq-swiper--${_ctx.effect}`, { "sq-swiper--dragging": _ctx.dragging, "sq-swiper--vertical": _ctx.vertical }]]),
200
+ style: normalizeStyle(_ctx.rootStyle),
201
+ role: "region",
202
+ "aria-roledescription": "carousel",
203
+ "aria-label": _ctx.label,
204
+ tabindex: "0",
205
+ onKeydown: [
206
+ _cache[1] || (_cache[1] = withKeys(withModifiers(($event) => !_ctx.vertical && _ctx.prev(), ["prevent"]), ["left"])),
207
+ _cache[2] || (_cache[2] = withKeys(withModifiers(($event) => !_ctx.vertical && _ctx.next(), ["prevent"]), ["right"])),
208
+ _cache[3] || (_cache[3] = withKeys(withModifiers(($event) => _ctx.vertical && _ctx.prev(), ["prevent"]), ["up"])),
209
+ _cache[4] || (_cache[4] = withKeys(withModifiers(($event) => _ctx.vertical && _ctx.next(), ["prevent"]), ["down"]))
210
+ ],
211
+ onMouseenter: _cache[5] || (_cache[5] = ($event) => _ctx.hovering = true),
212
+ onMouseleave: _cache[6] || (_cache[6] = ($event) => _ctx.hovering = false)
213
+ }, [
214
+ createVNode(_component_SqShape, { clip: "" }),
215
+ createElementVNode(
216
+ "div",
217
+ {
218
+ class: "sq-swiper__track",
219
+ onPointerdown: _cache[0] || (_cache[0] = (...args) => _ctx.onDown && _ctx.onDown(...args))
220
+ },
221
+ [
222
+ (openBlock(true), createElementBlock(
223
+ Fragment,
224
+ null,
225
+ renderList(_ctx.list, (item, i) => {
226
+ return openBlock(), createElementBlock("div", {
227
+ key: _ctx.keyOf(item, i),
228
+ class: normalizeClass(["sq-swiper__slide", { "sq-swiper__slide--active": i === _ctx.normIndex, "sq-swiper__slide--jump": _ctx.jumping.has(i) }]),
229
+ style: normalizeStyle(_ctx.slideStyle(i)),
230
+ role: "group",
231
+ "aria-roledescription": "slide",
232
+ "aria-label": `${i + 1} / ${_ctx.list.length}`,
233
+ "aria-hidden": _ctx.isVisible(i) ? void 0 : "true"
234
+ }, [
235
+ renderSlot(_ctx.$slots, "default", {
236
+ item,
237
+ index: i,
238
+ active: i === _ctx.normIndex
239
+ })
240
+ ], 14, _hoisted_2);
241
+ }),
242
+ 128
243
+ /* KEYED_FRAGMENT */
244
+ ))
245
+ ],
246
+ 32
247
+ /* NEED_HYDRATION */
248
+ ),
249
+ _ctx.navigation && _ctx.list.length > 1 ? (openBlock(), createElementBlock(
250
+ Fragment,
251
+ { key: 0 },
252
+ [
253
+ createVNode(_component_SqBtn, {
254
+ class: "sq-swiper__nav sq-swiper__nav--prev",
255
+ icon: _ctx.vertical ? "chevronUp" : "chevronLeft",
256
+ color: "surface",
257
+ variant: "elevated",
258
+ size: "small",
259
+ disabled: !_ctx.canPrev,
260
+ "aria-label": "Previous slide",
261
+ onClick: _ctx.prev
262
+ }, null, 8, ["icon", "disabled", "onClick"]),
263
+ createVNode(_component_SqBtn, {
264
+ class: "sq-swiper__nav sq-swiper__nav--next",
265
+ icon: _ctx.vertical ? "chevronDown" : "chevronRight",
266
+ color: "surface",
267
+ variant: "elevated",
268
+ size: "small",
269
+ disabled: !_ctx.canNext,
270
+ "aria-label": "Next slide",
271
+ onClick: _ctx.next
272
+ }, null, 8, ["icon", "disabled", "onClick"])
273
+ ],
274
+ 64
275
+ /* STABLE_FRAGMENT */
276
+ )) : createCommentVNode("v-if", true),
277
+ _ctx.pagination === "dots" && _ctx.pageCount > 1 ? (openBlock(), createElementBlock("div", _hoisted_3, [
278
+ (openBlock(true), createElementBlock(
279
+ Fragment,
280
+ null,
281
+ renderList(_ctx.pageCount, (p) => {
282
+ return openBlock(), createElementBlock("button", {
283
+ key: p,
284
+ type: "button",
285
+ class: normalizeClass(["sq-swiper__dot", { "sq-swiper__dot--active": p - 1 === _ctx.normIndex }]),
286
+ "aria-label": `Go to slide ${p}`,
287
+ onClick: ($event) => _ctx.goTo(p - 1)
288
+ }, null, 10, _hoisted_4);
289
+ }),
290
+ 128
291
+ /* KEYED_FRAGMENT */
292
+ ))
293
+ ])) : _ctx.pagination === "fraction" ? (openBlock(), createElementBlock(
294
+ "div",
295
+ _hoisted_5,
296
+ toDisplayString(_ctx.normIndex + 1) + " / " + toDisplayString(_ctx.list.length),
297
+ 1
298
+ /* TEXT */
299
+ )) : _ctx.pagination === "progress" ? (openBlock(), createElementBlock("div", _hoisted_6, [
300
+ createElementVNode(
301
+ "div",
302
+ {
303
+ style: normalizeStyle({ width: (_ctx.normIndex + 1) / Math.max(1, _ctx.list.length) * 100 + "%" })
304
+ },
305
+ null,
306
+ 4
307
+ /* STYLE */
308
+ )
309
+ ])) : createCommentVNode("v-if", true)
310
+ ], 46, _hoisted_1);
311
+ }
312
+ const SqSwiper = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
313
+ const componentNames = ["SqSwiper"];
314
+ export {
315
+ SqSwiper,
316
+ componentNames,
317
+ SqSwiper as default
318
+ };
319
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../../src/SqSwiper.vue","../../src/index.ts"],"sourcesContent":["<template>\n <div\n ref=\"root\"\n class=\"sq-swiper sq-surface\"\n :class=\"[`sq-swiper--${effect}`, { 'sq-swiper--dragging': dragging, 'sq-swiper--vertical': vertical }]\"\n :style=\"rootStyle\"\n role=\"region\"\n aria-roledescription=\"carousel\"\n :aria-label=\"label\"\n tabindex=\"0\"\n @keydown.left.prevent=\"!vertical && prev()\"\n @keydown.right.prevent=\"!vertical && next()\"\n @keydown.up.prevent=\"vertical && prev()\"\n @keydown.down.prevent=\"vertical && next()\"\n @mouseenter=\"hovering = true\"\n @mouseleave=\"hovering = false\"\n >\n <SqShape clip />\n <div class=\"sq-swiper__track\" @pointerdown=\"onDown\">\n <div\n v-for=\"(item, i) in list\"\n :key=\"keyOf(item, i)\"\n class=\"sq-swiper__slide\"\n :class=\"{ 'sq-swiper__slide--active': i === normIndex, 'sq-swiper__slide--jump': jumping.has(i) }\"\n :style=\"slideStyle(i)\"\n role=\"group\"\n aria-roledescription=\"slide\"\n :aria-label=\"`${i + 1} / ${list.length}`\"\n :aria-hidden=\"isVisible(i) ? undefined : 'true'\"\n >\n <slot :item=\"item\" :index=\"i\" :active=\"i === normIndex\" />\n </div>\n </div>\n <template v-if=\"navigation && list.length > 1\">\n <SqBtn class=\"sq-swiper__nav sq-swiper__nav--prev\" :icon=\"vertical ? 'chevronUp' : 'chevronLeft'\" color=\"surface\" variant=\"elevated\" size=\"small\" :disabled=\"!canPrev\" aria-label=\"Previous slide\" @click=\"prev\" />\n <SqBtn class=\"sq-swiper__nav sq-swiper__nav--next\" :icon=\"vertical ? 'chevronDown' : 'chevronRight'\" color=\"surface\" variant=\"elevated\" size=\"small\" :disabled=\"!canNext\" aria-label=\"Next slide\" @click=\"next\" />\n </template>\n <div v-if=\"pagination === 'dots' && pageCount > 1\" class=\"sq-swiper__dots\">\n <button v-for=\"p in pageCount\" :key=\"p\" type=\"button\" class=\"sq-swiper__dot\" :class=\"{ 'sq-swiper__dot--active': p - 1 === normIndex }\" :aria-label=\"`Go to slide ${p}`\" @click=\"goTo(p - 1)\"></button>\n </div>\n <div v-else-if=\"pagination === 'fraction'\" class=\"sq-swiper__fraction\">{{ normIndex + 1 }} / {{ list.length }}</div>\n <div v-else-if=\"pagination === 'progress'\" class=\"sq-swiper__progress\"><div :style=\"{ width: ((normIndex + 1) / Math.max(1, list.length)) * 100 + '%' }\"></div></div>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { computed, defineComponent, onBeforeUnmount, onMounted, ref, watch, type PropType } from 'vue'\nimport { getByPath } from '@squirkle-ui/core'\nimport { SqBtn, SqShape, radiusValue, useProxiedModel, vModel } from '@squirkle-ui/ui'\n\ntype Effect = 'slide' | 'fade' | 'coverflow' | 'cards'\ninterface Responsive { slidesPerView?: number; spaceBetween?: number }\n\n/**\n * Touch/mouse swiper. `loop` is a real infinite loop without cloned slides: every slide is positioned\n * at its wrapped offset from the active index, and slides that wrap around jump without animating.\n */\nexport default defineComponent({\n name: 'SqSwiper',\n components: { SqBtn, SqShape },\n model: vModel,\n props: {\n modelValue: { type: Number, default: 0 },\n items: { type: Array as PropType<unknown[]>, default: () => [] },\n itemKey: { type: String, default: undefined },\n slidesPerView: { type: Number, default: 1 },\n spaceBetween: { type: Number, default: 16 },\n /** { 640: { slidesPerView: 2 }, 1024: { slidesPerView: 3 } } — keys are min container widths. */\n breakpoints: { type: Object as PropType<Record<number, Responsive>>, default: undefined },\n effect: { type: String as PropType<Effect>, default: 'slide' },\n loop: Boolean,\n centered: Boolean,\n vertical: Boolean,\n /** Autoplay delay in ms; 0 disables. */\n autoplay: { type: Number, default: 0 },\n pauseOnHover: { type: Boolean, default: true },\n speed: { type: Number, default: 420 },\n navigation: { type: Boolean, default: true },\n pagination: { type: [String, Boolean] as PropType<'dots' | 'fraction' | 'progress' | false>, default: 'dots' },\n height: { type: [Number, String], default: 320 },\n rounded: { type: [String, Number], default: 'xl' },\n label: { type: String, default: 'Carousel' },\n },\n emits: ['update:modelValue', 'change'],\n setup(props, { emit }) {\n const model = useProxiedModel<number>(props, emit)\n const root = ref<HTMLElement | null>(null)\n const size = ref(800)\n const drag = ref(0)\n const dragging = ref(false)\n const hovering = ref(false)\n const jumping = ref(new Set<number>())\n const list = computed(() => props.items)\n const n = computed(() => list.value.length)\n const keyOf = (item: unknown, i: number) => (props.itemKey ? (getByPath(item, props.itemKey) as string) : i)\n\n const responsive = computed<Required<Responsive>>(() => {\n let r: Required<Responsive> = { slidesPerView: props.slidesPerView, spaceBetween: props.spaceBetween }\n if (props.breakpoints) for (const bp of Object.keys(props.breakpoints).map(Number).sort((a, b) => a - b)) if (size.value >= bp) r = { ...r, ...props.breakpoints[bp] }\n if (props.effect !== 'slide') r = { ...r, slidesPerView: 1 }\n return r\n })\n const spv = computed(() => Math.max(1, Math.min(responsive.value.slidesPerView, n.value || 1)))\n const slideSize = computed(() => (size.value - responsive.value.spaceBetween * (spv.value - 1)) / spv.value)\n const step = computed(() => slideSize.value + responsive.value.spaceBetween)\n const maxIndex = computed(() => (props.loop || props.centered ? n.value - 1 : Math.max(0, n.value - spv.value)))\n const normIndex = computed(() => (n.value ? ((model.value % n.value) + n.value) % n.value : 0))\n const pageCount = computed(() => (props.loop || props.centered ? n.value : maxIndex.value + 1))\n const canPrev = computed(() => props.loop || normIndex.value > 0)\n const canNext = computed(() => props.loop || normIndex.value < maxIndex.value)\n\n const offsetOf = (i: number) => {\n let o = i - normIndex.value\n if (props.loop && n.value > 1) {\n const half = n.value / 2\n o = ((((o + half) % n.value) + n.value) % n.value) - half\n }\n return o\n }\n const prevOffsets = new Map<number, number>()\n watch(normIndex, () => {\n const jumps = new Set<number>()\n for (let i = 0; i < n.value; i++) {\n const o = offsetOf(i)\n const was = prevOffsets.get(i)\n if (was != null && Math.abs(o - was) > 1.5) jumps.add(i)\n prevOffsets.set(i, o)\n }\n jumping.value = jumps\n requestAnimationFrame(() => requestAnimationFrame(() => (jumping.value = new Set())))\n emit('change', normIndex.value)\n })\n\n const isVisible = (i: number) => {\n const o = offsetOf(i)\n return props.centered ? Math.abs(o) <= spv.value / 2 : o >= 0 && o < spv.value\n }\n const slideStyle = (i: number) => {\n const o = offsetOf(i)\n const dragFrac = drag.value / step.value\n const pos = o + dragFrac\n const center = props.centered ? (size.value - slideSize.value) / 2 : 0\n const axis = props.vertical ? 'Y' : 'X'\n const s: Record<string, string> = { [props.vertical ? 'height' : 'width']: `${slideSize.value}px`, transitionDuration: dragging.value ? '0ms' : `${props.speed}ms` }\n if (props.effect === 'fade') {\n s.opacity = String(Math.max(0, 1 - Math.abs(pos)))\n s.zIndex = String(o === 0 ? 2 : 1)\n } else if (props.effect === 'coverflow') {\n const x = (size.value - slideSize.value) / 2 + pos * slideSize.value * 0.62\n s.transform = `translate${axis}(${x}px) perspective(900px) rotateY(${Math.max(-1, Math.min(1, pos)) * -42}deg) scale(${1 - Math.min(1, Math.abs(pos)) * 0.18})`\n s.zIndex = String(100 - Math.round(Math.abs(pos) * 10))\n s.opacity = Math.abs(pos) > 2.5 ? '0' : '1'\n } else if (props.effect === 'cards') {\n const p = Math.max(-1, pos)\n s.transform = p < 0 ? `translateX(${p * size.value}px) rotate(${p * 8}deg)` : `translateY(${Math.min(p, 3) * 14}px) scale(${1 - Math.min(p, 3) * 0.06})`\n s.zIndex = String(100 - Math.round(Math.abs(pos) * 10))\n s.opacity = pos > 3 ? '0' : '1'\n } else s.transform = `translate${axis}(${center + pos * step.value}px)`\n return s\n }\n\n const goTo = (i: number) => {\n if (!n.value) return\n if (props.loop) {\n const target = ((i % n.value) + n.value) % n.value\n model.value = model.value + offsetOfTarget(target)\n } else model.value = Math.max(0, Math.min(maxIndex.value, i))\n }\n const offsetOfTarget = (target: number) => {\n let d = target - normIndex.value\n const half = n.value / 2\n d = ((((d + half) % n.value) + n.value) % n.value) - half\n return d\n }\n const next = () => (canNext.value ? (props.loop ? (model.value = model.value + 1) : goTo(normIndex.value + 1)) : props.autoplay && goTo(0))\n const prev = () => canPrev.value && (props.loop ? (model.value = model.value - 1) : goTo(normIndex.value - 1))\n\n // drag\n let start = 0\n let startT = 0\n const onMove = (e: PointerEvent) => {\n const d = (props.vertical ? e.clientY : e.clientX) - start\n const edge = !props.loop && ((normIndex.value === 0 && d > 0) || (normIndex.value >= maxIndex.value && d < 0))\n drag.value = edge ? d * 0.3 : d\n }\n const onUp = () => {\n window.removeEventListener('pointermove', onMove)\n window.removeEventListener('pointerup', onUp)\n const d = drag.value\n const fast = Math.abs(d) > 30 && Date.now() - startT < 250\n const steps = Math.round(-d / step.value) || (fast ? -Math.sign(d) : 0)\n dragging.value = false\n drag.value = 0\n if (steps) props.loop ? (model.value = model.value + steps) : goTo(normIndex.value + steps)\n }\n const onDown = (e: PointerEvent) => {\n if (e.button !== 0 || (e.target as HTMLElement).closest('button, a, input')) return\n start = props.vertical ? e.clientY : e.clientX\n startT = Date.now()\n dragging.value = true\n window.addEventListener('pointermove', onMove)\n window.addEventListener('pointerup', onUp)\n }\n\n // autoplay\n let timer: ReturnType<typeof setInterval> | undefined\n const restart = () => {\n clearInterval(timer)\n if (props.autoplay > 0) timer = setInterval(() => !(props.pauseOnHover && hovering.value) && !dragging.value && !document.hidden && next(), props.autoplay)\n }\n watch(() => props.autoplay, restart)\n\n let ro: ResizeObserver | undefined\n onMounted(() => {\n const measure = () => root.value && (size.value = props.vertical ? root.value.clientHeight : root.value.clientWidth)\n measure()\n if (typeof ResizeObserver !== 'undefined' && root.value) { ro = new ResizeObserver(measure); ro.observe(root.value) }\n for (let i = 0; i < n.value; i++) prevOffsets.set(i, offsetOf(i))\n restart()\n })\n onBeforeUnmount(() => { clearInterval(timer); ro?.disconnect(); onUp() })\n\n const rootStyle = computed(() => ({ height: typeof props.height === 'number' ? `${props.height}px` : props.height, '--sq-r': radiusValue(props.rounded as string), '--sq-bg': 'var(--sq-surface-variant)' }))\n return { root, list, keyOf, normIndex, pageCount, canPrev, canNext, slideStyle, isVisible, goTo, next, prev, onDown, dragging, hovering, jumping, rootStyle }\n },\n})\n</script>\n\n<style>\n.sq-swiper { position: relative; overflow: hidden; outline: none; touch-action: pan-y; user-select: none; }\n.sq-swiper--vertical { touch-action: pan-x; }\n.sq-swiper:focus-visible { box-shadow: var(--sq-focus-ring); }\n.sq-swiper__track { position: relative; width: 100%; height: 100%; cursor: grab; }\n.sq-swiper--dragging .sq-swiper__track { cursor: grabbing; }\n.sq-swiper__slide { position: absolute; top: 0; left: 0; height: 100%; transition-property: transform, opacity; transition-timing-function: var(--sq-ease); will-change: transform; }\n.sq-swiper--vertical .sq-swiper__slide { width: 100%; height: auto; }\n.sq-swiper__slide--jump { transition: none !important; }\n.sq-swiper__slide > * { width: 100%; height: 100%; }\n.sq-swiper--fade .sq-swiper__slide, .sq-swiper--cards .sq-swiper__slide { width: 100% !important; }\n.sq-swiper--cards { overflow: visible; --sq-bg: transparent; }\n.sq-swiper__nav { position: absolute; top: 50%; z-index: 120; transform: translateY(-50%); }\n.sq-swiper__nav--prev { left: var(--sq-space-3); }\n.sq-swiper__nav--next { right: var(--sq-space-3); }\n.sq-swiper--vertical .sq-swiper__nav { left: 50%; top: auto; transform: translateX(-50%); }\n.sq-swiper--vertical .sq-swiper__nav--prev { top: var(--sq-space-3); }\n.sq-swiper--vertical .sq-swiper__nav--next { bottom: var(--sq-space-3); }\n.sq-swiper__dots { position: absolute; z-index: 120; left: 50%; bottom: var(--sq-space-3); transform: translateX(-50%); display: flex; gap: 6px; padding: 6px 8px; border-radius: var(--sq-radius-pill); background: color-mix(in srgb, var(--sq-overlay) 28%, transparent); backdrop-filter: blur(8px); }\n.sq-swiper__dot { width: 7px; height: 7px; padding: 0; border: 0; border-radius: var(--sq-radius-pill); background: rgb(255 255 255 / 0.55); cursor: pointer; transition: width var(--sq-duration) var(--sq-ease), background var(--sq-duration); }\n.sq-swiper__dot--active { width: 22px; background: #fff; }\n.sq-swiper__fraction { position: absolute; z-index: 120; right: var(--sq-space-3); bottom: var(--sq-space-3); padding: 2px 10px; border-radius: var(--sq-radius-pill); background: color-mix(in srgb, var(--sq-overlay) 45%, transparent); color: #fff; font-size: var(--sq-text-xs); font-weight: var(--sq-weight-semibold); }\n.sq-swiper__progress { position: absolute; z-index: 120; left: 0; right: 0; bottom: 0; height: 4px; background: color-mix(in srgb, var(--sq-overlay) 20%, transparent); }\n.sq-swiper__progress > div { height: 100%; background: var(--sq-primary); transition: width var(--sq-duration-slow) var(--sq-ease); }\n</style>\n","import SqSwiper from './SqSwiper.vue'\n\nexport { SqSwiper }\nexport const componentNames = ['SqSwiper'] as const\nexport default SqSwiper\n"],"names":["_createElementBlock","_normalizeClass","_normalizeStyle","_withKeys","_withModifiers","_createVNode","_createElementVNode","_openBlock","_Fragment","_renderList","_renderSlot","_toDisplayString"],"mappings":";;;AAyDA,MAAA,YAAe,gBAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,YAAY,EAAE,OAAO,QAAA;AAAA,EACrB,OAAO;AAAA,EACP,OAAO;AAAA,IACL,YAAY,EAAE,MAAM,QAAQ,SAAS,EAAA;AAAA,IACrC,OAAO,EAAE,MAAM,OAA8B,SAAS,MAAM,CAAA,EAAC;AAAA,IAC7D,SAAS,EAAE,MAAM,QAAQ,SAAS,OAAA;AAAA,IAClC,eAAe,EAAE,MAAM,QAAQ,SAAS,EAAA;AAAA,IACxC,cAAc,EAAE,MAAM,QAAQ,SAAS,GAAA;AAAA;AAAA,IAEvC,aAAa,EAAE,MAAM,QAAgD,SAAS,OAAA;AAAA,IAC9E,QAAQ,EAAE,MAAM,QAA4B,SAAS,QAAA;AAAA,IACrD,MAAM;AAAA,IACN,UAAU;AAAA,IACV,UAAU;AAAA;AAAA,IAEV,UAAU,EAAE,MAAM,QAAQ,SAAS,EAAA;AAAA,IACnC,cAAc,EAAE,MAAM,SAAS,SAAS,KAAA;AAAA,IACxC,O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A,GAAA,MAAA,IAAA,UAAA;AAAA;;;;IAEzK,CAAA,KAAA,KAAA,eAAU,cAAAM,UAAA,GAA1BP;AAAAA,MAAoH;AAAA,MAApH;AAAA,MAAoHW,gBAA1C,KAAA,YAAS,CAAA,IAAO,QAAGA,gBAAG,UAAK,MAAM;AAAA,MAAA;AAAA;AAAA,IAAA,KAC3F,KAAA,eAAU,cAAAJ,UAAA,GAA1BP,mBAAqK,OAArK,YAAqK;AAAA,MAA9FM;AAAAA,QAAwF;AAAA,QAAA;AAAA,UAAlF,OAAKJ,yBAAa,KAAA,YAAS,KAAQ,KAAK,IAAG,GAAI,UAAK,MAAM,IAAA,MAAA,IAAA,CAAA;AAAA,QAAA;AAAA;;;;;;;;ACtCpI,MAAM,iBAAiB,CAAC,UAAU;"}
@@ -0,0 +1,47 @@
1
+
2
+ .sq-swiper { position: relative; overflow: hidden; outline: none; touch-action: pan-y; user-select: none;
3
+ }
4
+ .sq-swiper--vertical { touch-action: pan-x;
5
+ }
6
+ .sq-swiper:focus-visible { box-shadow: var(--sq-focus-ring);
7
+ }
8
+ .sq-swiper__track { position: relative; width: 100%; height: 100%; cursor: grab;
9
+ }
10
+ .sq-swiper--dragging .sq-swiper__track { cursor: grabbing;
11
+ }
12
+ .sq-swiper__slide { position: absolute; top: 0; left: 0; height: 100%; transition-property: transform, opacity; transition-timing-function: var(--sq-ease); will-change: transform;
13
+ }
14
+ .sq-swiper--vertical .sq-swiper__slide { width: 100%; height: auto;
15
+ }
16
+ .sq-swiper__slide--jump { transition: none !important;
17
+ }
18
+ .sq-swiper__slide > * { width: 100%; height: 100%;
19
+ }
20
+ .sq-swiper--fade .sq-swiper__slide, .sq-swiper--cards .sq-swiper__slide { width: 100% !important;
21
+ }
22
+ .sq-swiper--cards { overflow: visible; --sq-bg: transparent;
23
+ }
24
+ .sq-swiper__nav { position: absolute; top: 50%; z-index: 120; transform: translateY(-50%);
25
+ }
26
+ .sq-swiper__nav--prev { left: var(--sq-space-3);
27
+ }
28
+ .sq-swiper__nav--next { right: var(--sq-space-3);
29
+ }
30
+ .sq-swiper--vertical .sq-swiper__nav { left: 50%; top: auto; transform: translateX(-50%);
31
+ }
32
+ .sq-swiper--vertical .sq-swiper__nav--prev { top: var(--sq-space-3);
33
+ }
34
+ .sq-swiper--vertical .sq-swiper__nav--next { bottom: var(--sq-space-3);
35
+ }
36
+ .sq-swiper__dots { position: absolute; z-index: 120; left: 50%; bottom: var(--sq-space-3); transform: translateX(-50%); display: flex; gap: 6px; padding: 6px 8px; border-radius: var(--sq-radius-pill); background: color-mix(in srgb, var(--sq-overlay) 28%, transparent); backdrop-filter: blur(8px);
37
+ }
38
+ .sq-swiper__dot { width: 7px; height: 7px; padding: 0; border: 0; border-radius: var(--sq-radius-pill); background: rgb(255 255 255 / 0.55); cursor: pointer; transition: width var(--sq-duration) var(--sq-ease), background var(--sq-duration);
39
+ }
40
+ .sq-swiper__dot--active { width: 22px; background: #fff;
41
+ }
42
+ .sq-swiper__fraction { position: absolute; z-index: 120; right: var(--sq-space-3); bottom: var(--sq-space-3); padding: 2px 10px; border-radius: var(--sq-radius-pill); background: color-mix(in srgb, var(--sq-overlay) 45%, transparent); color: #fff; font-size: var(--sq-text-xs); font-weight: var(--sq-weight-semibold);
43
+ }
44
+ .sq-swiper__progress { position: absolute; z-index: 120; left: 0; right: 0; bottom: 0; height: 4px; background: color-mix(in srgb, var(--sq-overlay) 20%, transparent);
45
+ }
46
+ .sq-swiper__progress > div { height: 100%; background: var(--sq-primary); transition: width var(--sq-duration-slow) var(--sq-ease);
47
+ }
package/package.json CHANGED
@@ -1,6 +1,63 @@
1
1
  {
2
2
  "name": "@squirkle-ui/swiper",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.1",
4
+ "description": "Touch swiper / carousel for Squirkle UI",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/KheangLov/squirkle-ui.git",
9
+ "directory": "packages/swiper"
10
+ },
11
+ "homepage": "https://github.com/KheangLov/squirkle-ui#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/KheangLov/squirkle-ui/issues"
14
+ },
15
+ "keywords": [
16
+ "vue",
17
+ "carousel",
18
+ "swiper",
19
+ "slider"
20
+ ],
21
+ "type": "module",
22
+ "sideEffects": [
23
+ "*.css"
24
+ ],
25
+ "files": [
26
+ "dist"
27
+ ],
28
+ "main": "./dist/vue3/index.cjs",
29
+ "module": "./dist/vue3/index.mjs",
30
+ "types": "./dist/types/index.d.ts",
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/types/index.d.ts",
34
+ "import": "./dist/vue3/index.mjs",
35
+ "require": "./dist/vue3/index.cjs"
36
+ },
37
+ "./vue2": {
38
+ "types": "./dist/types/index.d.ts",
39
+ "import": "./dist/vue2/index.mjs",
40
+ "require": "./dist/vue2/index.cjs"
41
+ },
42
+ "./styles.css": "./dist/styles.css",
43
+ "./dist/types/*": {
44
+ "types": "./dist/types/*.d.ts"
45
+ }
46
+ },
47
+ "peerDependencies": {
48
+ "vue": "^2.7.0 || ^3.3.0",
49
+ "@squirkle-ui/ui": "^0.1.1"
50
+ },
51
+ "dependencies": {
52
+ "@squirkle-ui/core": "^0.1.1"
53
+ },
54
+ "devDependencies": {
55
+ "@squirkle-ui/ui": "^0.1.1"
56
+ },
57
+ "publishConfig": {
58
+ "access": "public"
59
+ },
60
+ "scripts": {
61
+ "build": "node ../../scripts/build.mjs swiper"
62
+ }
6
63
  }