UNPKG

@aotearoan/neon

Version:

Neon is a lightweight design library of Vue 3 components with minimal dependencies.

3 lines (2 loc) 1.24 kB
"use strict";const l=require("vue"),s=require("../../../model/common/layout/NeonOrientation.cjs.js"),v=l.defineComponent({name:"NeonSwiper",props:{fade:{type:Boolean,default:!0},orientation:{type:String,default:s.NeonOrientation.Horizontal},hideFadeStart:{type:Boolean,default:!1},hideFadeEnd:{type:Boolean,default:!1}},setup(u){const e=l.ref(null),n=l.ref(!1),a=l.ref(!1),o=l.ref(!1),i=()=>{e.value?u.orientation===s.NeonOrientation.Horizontal?(a.value=e.value.scrollLeft<=0,o.value=e.value.scrollLeft+e.value.clientWidth>e.value.scrollWidth-1):(a.value=e.value.scrollTop<=0,o.value=e.value.scrollTop+e.value.clientHeight>e.value.scrollHeight-1):(a.value=!1,o.value=!1)},r=()=>{e.value?u.orientation===s.NeonOrientation.Horizontal?n.value=e.value.scrollWidth>e.value.clientWidth:n.value=e.value.scrollHeight>e.value.clientHeight:n.value=!1,i()};return l.onMounted(()=>{var t;window.addEventListener("resize",r,{passive:!0}),(t=e.value)==null||t.addEventListener("scroll",i,{passive:!0}),r()}),l.onUnmounted(()=>{var t;window.removeEventListener("resize",r),(t=e.value)==null||t.removeEventListener("scroll",i)}),{isOverflowing:n,isScrollStart:a,isScrollEnd:o,scrollable:e}}});module.exports=v; //# sourceMappingURL=NeonSwiper.cjs.js.map