motion-plus-vue
Version:
Motion Plus Vue
80 lines (79 loc) • 2.31 kB
JavaScript
import { defineComponent as d, createBlock as u, openBlock as m, unref as o, mergeProps as y, withCtx as t, renderSlot as i, createVNode as c } from "vue";
import { useMotionValue as r, useTransform as B, useDomRef as k } from "motion-v";
import { Ticker as O } from "../Ticker/index.mjs";
import { defaultTransition as C } from "./const.mjs";
import T from "./CarouselView.vue.mjs";
const M = /* @__PURE__ */ d({
name: "Carousel",
inheritAttrs: !1,
__name: "Carousel",
props: {
snap: { type: [String, Boolean], default: "page" },
transition: { default: () => ({
...C
}) },
axis: { default: "x" },
gap: {},
align: {},
itemSize: {},
overflow: { type: Boolean },
loop: { type: Boolean, default: !0 },
safeMargin: {},
fade: {},
fadeTransition: {},
pageTransition: {},
_dragX: { type: [Object, Boolean] },
_dragY: { type: [Object, Boolean] },
as: {},
style: {},
onDragEnd: {},
drag: { type: [Boolean, String] },
dragConstraints: { type: [Boolean, Object] },
dragMomentum: { type: Boolean }
},
setup(p) {
const l = p, a = r(0), s = r(0), n = r(0), g = B(() => n.get() + s.get()), f = k();
return (e, S) => (m(), u(o(O), y({
...l,
...e.$attrs
}, {
ref_key: "tickerRef",
ref: f,
role: "region",
"aria-roledescription": "carousel",
offset: o(g),
loop: e.loop,
axis: e.axis,
drag: e.axis,
"_drag-x": e.axis === "x" ? o(a) : !1,
"_drag-y": e.axis === "y" ? o(a) : !1,
snap: e.snap,
"page-transition": e.transition
}), {
after: t(() => [
c(T, {
"ticker-ref": o(f),
loop: e.loop,
offset: o(s),
"tug-offset": o(n),
"target-offset": o(a),
transition: e.transition,
snap: e.snap,
axis: e.axis
}, {
default: t(() => [
i(e.$slots, "after")
]),
_: 3
}, 8, ["ticker-ref", "loop", "offset", "tug-offset", "target-offset", "transition", "snap", "axis"])
]),
default: t(() => [
i(e.$slots, "default")
]),
_: 3
}, 16, ["offset", "loop", "axis", "drag", "_drag-x", "_drag-y", "snap", "page-transition"]));
}
});
export {
M as default
};