bootstrap-vue-next
Version:
BootstrapVueNext is an early and lovely component library for Vue 3 & Nuxt 3 based on Bootstrap 5 and Typescript.
3 lines (2 loc) • 17.1 kB
JavaScript
const e=require("./index-BjjsoN-a.js"),t=require("vue");function n(t){const n={};for(const o in t)n[e.camelize(o)]=t[o];return n}const o=e.isClient?window:void 0;function l(e){var n;const o=t.toValue(e);return null!=(n=null==o?void 0:o.$el)?n:o}function a(...n){const a=[],r=()=>{a.forEach((e=>e())),a.length=0},u=t.computed((()=>{const o=e.toArray(t.toValue(n[0])).filter((e=>null!=e));return o.every((e=>"string"!=typeof e))?o:void 0})),s=e.watchImmediate((()=>{var a,r;return[null!=(r=null==(a=u.value)?void 0:a.map((e=>l(e))))?r:[o].filter((e=>null!=e)),e.toArray(t.toValue(u.value?n[1]:n[0])),e.toArray(t.unref(u.value?n[2]:n[1])),t.toValue(u.value?n[3]:n[2])]}),(([t,n,o,l])=>{if(r(),!(null==t?void 0:t.length)||!(null==n?void 0:n.length)||!(null==o?void 0:o.length))return;const u=e.isObject(l)?{...l}:l;a.push(...t.flatMap((e=>n.flatMap((t=>o.map((n=>((e,t,n,o)=>(e.addEventListener(t,n,o),()=>e.removeEventListener(t,n,o)))(e,t,n,u))))))))}),{flush:"post"});return e.tryOnScopeDispose(r),()=>{s(),r()}}let r=!1;function u(e){const n=function(){const e=t.shallowRef(!1),n=t.getCurrentInstance();return n&&t.onMounted((()=>{e.value=!0}),n),e}();return t.computed((()=>(n.value,Boolean(e()))))}function s(n,a,r={}){const{window:s=o,...i}=r;let c;const d=u((()=>s&&"MutationObserver"in s)),f=()=>{c&&(c.disconnect(),c=void 0)},v=t.computed((()=>{const o=t.toValue(n),a=e.toArray(o).map(l).filter(e.notNullish);return new Set(a)})),p=t.watch((()=>v.value),(e=>{f(),d.value&&e.size&&(c=new MutationObserver(a),e.forEach((e=>c.observe(e,i))))}),{immediate:!0,flush:"post"}),m=()=>{p(),f()};return e.tryOnScopeDispose(m),{isSupported:d,stop:m,takeRecords:()=>null==c?void 0:c.takeRecords()}}const i=Symbol("vueuse-ssr-width");function c(){const n=t.hasInjectionContext()?e.injectLocal(i,null):null;return"number"==typeof n?n:void 0}function d(n,l={}){const{window:r=o,ssrWidth:s=c()}=l,i=u((()=>r&&"matchMedia"in r&&"function"==typeof r.matchMedia)),d=t.shallowRef("number"==typeof s),f=t.shallowRef(),v=t.shallowRef(!1);return t.watchEffect((()=>{if(d.value){d.value=!i.value;const o=t.toValue(n).split(",");v.value=o.some((t=>{const n=t.includes("not all"),o=t.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/),l=t.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);let a=Boolean(o||l);return o&&a&&(a=s>=e.pxValue(o[1])),l&&a&&(a=s<=e.pxValue(l[1])),n?!a:a}))}else i.value&&(f.value=r.matchMedia(t.toValue(n)),v.value=f.value.matches)})),a(f,"change",(e=>{v.value=e.matches}),{passive:!0}),t.computed((()=>v.value))}const f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},v="__vueuse_ssr_handlers__",p=m();function m(){return v in f||(f[v]=f[v]||{}),f[v]}function h(e,t){return p[e]||t}const w={boolean:{read:e=>"true"===e,write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e))},date:{read:e=>new Date(e),write:e=>e.toISOString()}},g="vueuse-storage";function y(n,l,r,u={}){var s;const{flush:i="pre",deep:c=!0,listenToStorageChanges:d=!0,writeDefaults:f=!0,mergeDefaults:v=!1,shallow:p,window:m=o,eventFilter:y,onError:b=e=>{console.error(e)},initOnMounted:S}=u,x=(p?t.shallowRef:t.ref)("function"==typeof l?l():l),O=t.computed((()=>t.toValue(n)));if(!r)try{r=h("getDefaultStorage",(()=>{var e;return null==(e=o)?void 0:e.localStorage}))()}catch(D){b(D)}if(!r)return x;const E=t.toValue(l),V=function(e){return null==e?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":"boolean"==typeof e?"boolean":"string"==typeof e?"string":"object"==typeof e?"object":Number.isNaN(e)?"any":"number"}(E),A=null!=(s=u.serializer)?s:w[V],{pause:k,resume:M}=e.watchPausable(x,(()=>function(e){try{const t=r.getItem(O.value);if(null==e)R(t,null),r.removeItem(O.value);else{const n=A.write(e);t!==n&&(r.setItem(O.value,n),R(t,n))}}catch(D){b(D)}}(x.value)),{flush:i,deep:c,eventFilter:y});function R(e,t){if(m){const n={key:O.value,oldValue:e,newValue:t,storageArea:r};m.dispatchEvent(r instanceof Storage?new StorageEvent("storage",n):new CustomEvent(g,{detail:n}))}}function N(e){if(!e||e.storageArea===r)if(e&&null==e.key)x.value=E;else if(!e||e.key===O.value){k();try{(null==e?void 0:e.newValue)!==A.write(x.value)&&(x.value=function(e){const t=e?e.newValue:r.getItem(O.value);if(null==t)return f&&null!=E&&r.setItem(O.value,A.write(E)),E;if(!e&&v){const e=A.read(t);return"function"==typeof v?v(e,E):"object"!==V||Array.isArray(e)?e:{...E,...e}}return"string"!=typeof t?t:A.read(t)}(e))}catch(D){b(D)}finally{e?t.nextTick(M):M()}}}function T(e){N(e.detail)}return t.watch(O,(()=>N()),{flush:i}),m&&d&&e.tryOnMounted((()=>{r instanceof Storage?a(m,"storage",N,{passive:!0}):a(m,g,T),S&&N()})),S||N(),x}function b(e){return"undefined"!=typeof Window&&e instanceof Window?e.document.documentElement:"undefined"!=typeof Document&&e instanceof Document?e.documentElement:e}const S={page:e=>[e.pageX,e.pageY],client:e=>[e.clientX,e.clientY],screen:e=>[e.screenX,e.screenY],movement:e=>e instanceof MouseEvent?[e.movementX,e.movementY]:null};function x(e){const t=window.getComputedStyle(e);if("scroll"===t.overflowX||"scroll"===t.overflowY||"auto"===t.overflowX&&e.clientWidth<e.scrollWidth||"auto"===t.overflowY&&e.clientHeight<e.scrollHeight)return!0;{const t=e.parentNode;return!(!t||"BODY"===t.tagName)&&x(t)}}function O(e){const t=e||window.event;return!x(t.target)&&(t.touches.length>1||(t.preventDefault&&t.preventDefault(),!1))}const E=new WeakMap;exports.breakpointsBootstrapV5={xs:0,sm:576,md:768,lg:992,xl:1200,xxl:1400},exports.createReusableTemplate=function(o={}){const{inheritAttrs:l=!0}=o,a=t.shallowRef(),r=t.defineComponent({setup:(e,{slots:t})=>()=>{a.value=t.default}}),u=t.defineComponent({inheritAttrs:l,props:o.props,setup:(e,{attrs:t,slots:r})=>()=>{var u;if(!a.value&&"production"!==process.env.NODE_ENV)throw new Error("[VueUse] Failed to find the definition of reusable template");const s=null==(u=a.value)?void 0:u.call(a,{...null==o.props?n(t):e,$slots:r});return l&&1===(null==s?void 0:s.length)?s[0]:s}});return e.makeDestructurable({define:r,reuse:u},[r,u])},exports.getSSRHandler=h,exports.onClickOutside=function(n,u,s={}){const{window:i=o,ignore:c=[],capture:d=!0,detectIframe:f=!1,controls:v=!1}=s;if(!i)return v?{stop:e.noop,cancel:e.noop,trigger:e.noop}:e.noop;if(e.isIOS&&!r){r=!0;const t={passive:!0};Array.from(i.document.body.children).forEach((n=>a(n,"click",e.noop,t))),a(i.document.documentElement,"click",e.noop,t)}let p=!0;const m=e=>t.toValue(c).some((t=>{if("string"==typeof t)return Array.from(i.document.querySelectorAll(t)).some((t=>t===e.target||e.composedPath().includes(t)));{const n=l(t);return n&&(e.target===n||e.composedPath().includes(n))}})),h=e=>{const o=l(n);null!=e.target&&(o instanceof Element||!function(e){const n=t.toValue(e);return n&&16===n.$.subTree.shapeFlag}(n)||!function(e,n){const o=t.toValue(e),l=o.$.subTree&&o.$.subTree.children;return!(null==l||!Array.isArray(l))&&l.some((e=>e.el===n.target||n.composedPath().includes(e.el)))}(n,e))&&o&&o!==e.target&&!e.composedPath().includes(o)&&("detail"in e&&0===e.detail&&(p=!m(e)),p?u(e):p=!0)};let w=!1;const g=[a(i,"click",(e=>{w||(w=!0,setTimeout((()=>{w=!1}),0),h(e))}),{passive:!0,capture:d}),a(i,"pointerdown",(e=>{const t=l(n);p=!m(e)&&!(!t||e.composedPath().includes(t))}),{passive:!0}),f&&a(i,"blur",(e=>{setTimeout((()=>{var t;const o=l(n);"IFRAME"!==(null==(t=i.document.activeElement)?void 0:t.tagName)||(null==o?void 0:o.contains(i.document.activeElement))||u(e)}),0)}),{passive:!0})].filter(Boolean),y=()=>g.forEach((e=>e()));return v?{stop:y,cancel:()=>{p=!1},trigger:e=>{p=!0,h(e),p=!1}}:y},exports.onKeyStroke=function(...e){let n,l,r={};3===e.length?(n=e[0],l=e[1],r=e[2]):2===e.length?"object"==typeof e[1]?(n=!0,l=e[0],r=e[1]):(n=e[0],l=e[1]):(n=!0,l=e[0]);const{target:u=o,eventName:s="keydown",passive:i=!1,dedupe:c=!1}=r,d="function"==typeof(f=n)?f:"string"==typeof f?e=>e.key===f:Array.isArray(f)?e=>f.includes(e.key):()=>!0;var f;return a(u,s,(e=>{e.repeat&&t.toValue(c)||d(e)&&l(e)}),i)},exports.unrefElement=l,exports.useBreakpoints=function(n,l={}){function a(o,l){let a=t.toValue(n[t.toValue(o)]);return null!=l&&(a=e.increaseWithUnit(a,l)),"number"==typeof a&&(a=`${a}px`),a}const{window:r=o,strategy:u="min-width",ssrWidth:s=c()}=l,i="number"==typeof s,f=i?t.shallowRef(!1):{value:!0};function v(t,n){return!f.value&&i?"min"===t?s>=e.pxValue(n):s<=e.pxValue(n):!!r&&r.matchMedia(`(${t}-width: ${n})`).matches}i&&e.tryOnMounted((()=>f.value=!!r));const p=e=>d((()=>`(min-width: ${a(e)})`),l),m=e=>d((()=>`(max-width: ${a(e)})`),l),h=Object.keys(n).reduce(((e,t)=>(Object.defineProperty(e,t,{get:()=>"min-width"===u?p(t):m(t),enumerable:!0,configurable:!0}),e)),{});function w(){const o=Object.keys(n).map((t=>[t,h[t],e.pxValue(a(t))])).sort(((e,t)=>e[2]-t[2]));return t.computed((()=>o.filter((([,e])=>e.value)).map((([e])=>e))))}return Object.assign(h,{greaterOrEqual:p,smallerOrEqual:m,greater:e=>d((()=>`(min-width: ${a(e,.1)})`),l),smaller:e=>d((()=>`(max-width: ${a(e,-.1)})`),l),between:(e,t)=>d((()=>`(min-width: ${a(e)}) and (max-width: ${a(t,-.1)})`),l),isGreater:e=>v("min",a(e,.1)),isGreaterOrEqual:e=>v("min",a(e)),isSmaller:e=>v("max",a(e,-.1)),isSmallerOrEqual:e=>v("max",a(e)),isInBetween:(e,t)=>v("min",a(e))&&v("max",a(t,-.1)),current:w,active(){const e=w();return t.computed((()=>0===e.value.length?"":e.value.at("min-width"===u?-1:0)))}})},exports.useColorMode=function(n={}){const{selector:a="html",attribute:r="class",initialValue:u="auto",window:s=o,storage:i,storageKey:c="vueuse-color-scheme",listenToStorageChanges:f=!0,storageRef:v,emitAuto:p,disableTransition:m=!0}=n,w={auto:"",light:"light",dark:"dark",...n.modes||{}},g=function(e){return d("(prefers-color-scheme: dark)",e)}({window:s}),b=t.computed((()=>g.value?"dark":"light")),S=v||(null==c?e.toRef(u):y(c,u,i,{window:s,listenToStorageChanges:f})),x=t.computed((()=>"auto"===S.value?b.value:S.value)),O=h("updateHTMLAttrs",((e,t,n)=>{const o="string"==typeof e?null==s?void 0:s.document.querySelector(e):l(e);if(!o)return;const a=new Set,r=new Set;let u,i=null;if("class"===t){const e=n.split(/\s/g);Object.values(w).flatMap((e=>(e||"").split(/\s/g))).filter(Boolean).forEach((t=>{e.includes(t)?a.add(t):r.add(t)}))}else i={key:t,value:n};if(0!==a.size||0!==r.size||null!==i){m&&(u=s.document.createElement("style"),u.appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),s.document.head.appendChild(u));for(const e of a)o.classList.add(e);for(const e of r)o.classList.remove(e);i&&o.setAttribute(i.key,i.value),m&&(s.getComputedStyle(u).opacity,document.head.removeChild(u))}}));function E(e){var t;O(a,r,null!=(t=w[e])?t:e)}function V(e){n.onChanged?n.onChanged(e,E):E(e)}t.watch(x,V,{flush:"post",immediate:!0}),e.tryOnMounted((()=>V(x.value)));const A=t.computed({get:()=>p?S.value:x.value,set(e){S.value=e}});return Object.assign(A,{store:S,system:b,state:x})},exports.useElementHover=function(n,r={}){const{delayEnter:u=0,delayLeave:i=0,triggerOnRemoval:c=!1,window:d=o}=r,f=t.shallowRef(!1);let v;const p=e=>{const t=e?u:i;v&&(clearTimeout(v),v=void 0),t?v=setTimeout((()=>f.value=e),t):f.value=e};return d?(a(n,"mouseenter",(()=>p(!0)),{passive:!0}),a(n,"mouseleave",(()=>p(!1)),{passive:!0}),c&&function(n,a,r={}){const{window:u=o,document:i=(null==u?void 0:u.document),flush:c="sync"}=r;if(!u||!i)return e.noop;let d;const f=e=>{null==d||d(),d=e},v=t.watchEffect((()=>{const e=l(n);if(e){const{stop:t}=s(i,(t=>{t.map((e=>[...e.removedNodes])).flat().some((t=>t===e||t.contains(e)))&&a(t)}),{window:u,childList:!0,subtree:!0});f(t)}}),{flush:c}),p=()=>{v(),f()};e.tryOnScopeDispose(p)}(t.computed((()=>l(n))),(()=>p(!1))),f):f},exports.useEventListener=a,exports.useFocus=function(e,n={}){const{initialValue:o=!1,focusVisible:r=!1,preventScroll:u=!1}=n,s=t.shallowRef(!1),i=t.computed((()=>l(e))),c={passive:!0};a(i,"focus",(e=>{var t,n;r&&!(null==(n=(t=e.target).matches)?void 0:n.call(t,":focus-visible"))||(s.value=!0)}),c),a(i,"blur",(()=>s.value=!1),c);const d=t.computed({get:()=>s.value,set(e){var t,n;!e&&s.value?null==(t=i.value)||t.blur():e&&!s.value&&(null==(n=i.value)||n.focus({preventScroll:u}))}});return t.watch(i,(()=>{d.value=o}),{immediate:!0,flush:"post"}),{focused:d}},exports.useIntersectionObserver=function(n,a,r={}){const{root:s,rootMargin:i="0px",threshold:c=0,window:d=o,immediate:f=!0}=r,v=u((()=>d&&"IntersectionObserver"in d)),p=t.computed((()=>{const o=t.toValue(n);return e.toArray(o).map(l).filter(e.notNullish)}));let m=e.noop;const h=t.shallowRef(f),w=v.value?t.watch((()=>[p.value,l(s),h.value]),(([t,n])=>{if(m(),!h.value)return;if(!t.length)return;const o=new IntersectionObserver(a,{root:l(n),rootMargin:i,threshold:c});t.forEach((e=>e&&o.observe(e))),m=()=>{o.disconnect(),m=e.noop}}),{immediate:f,flush:"post"}):e.noop,g=()=>{m(),w(),h.value=!1};return e.tryOnScopeDispose(g),{isSupported:v,isActive:h,pause(){m(),h.value=!1},resume(){h.value=!0},stop:g}},exports.useMouse=function(e={}){const{type:n="page",touch:l=!0,resetOnTouchEnds:r=!1,initialValue:u={x:0,y:0},window:s=o,target:i=s,scroll:c=!0,eventFilter:d}=e;let f=null,v=0,p=0;const m=t.shallowRef(u.x),h=t.shallowRef(u.y),w=t.shallowRef(null),g="function"==typeof n?n:S[n],y=e=>{const t=g(e);f=e,t&&([m.value,h.value]=t,w.value="mouse"),s&&(v=s.scrollX,p=s.scrollY)},b=e=>{if(e.touches.length>0){const t=g(e.touches[0]);t&&([m.value,h.value]=t,w.value="touch")}},x=()=>{if(!f||!s)return;const e=g(f);f instanceof MouseEvent&&e&&(m.value=e[0]+s.scrollX-v,h.value=e[1]+s.scrollY-p)},O=()=>{m.value=u.x,h.value=u.y},E=d?e=>d((()=>y(e)),{}):e=>y(e),V=d?e=>d((()=>b(e)),{}):e=>b(e),A=d?()=>d((()=>x()),{}):()=>x();if(i){const e={passive:!0};a(i,["mousemove","dragover"],E,e),l&&"movement"!==n&&(a(i,["touchstart","touchmove"],V,e),r&&a(i,"touchend",O,e)),c&&"page"===n&&a(s,"scroll",A,e)}return{x:m,y:h,sourceType:w}},exports.useMutationObserver=s,exports.useScrollLock=function(n,o=!1){const l=t.shallowRef(o);let r=null,u="";t.watch(e.toRef(n),(e=>{const n=b(t.toValue(e));if(n){const e=n;if(E.get(e)||E.set(e,e.style.overflow),"hidden"!==e.style.overflow&&(u=e.style.overflow),"hidden"===e.style.overflow)return l.value=!0;if(l.value)return e.style.overflow="hidden"}}),{immediate:!0});const s=()=>{const o=b(t.toValue(n));o&&l.value&&(e.isIOS&&(null==r||r()),o.style.overflow=u,E.delete(o),l.value=!1)};return e.tryOnScopeDispose(s),t.computed({get:()=>l.value,set(o){o?(()=>{const o=b(t.toValue(n));o&&!l.value&&(e.isIOS&&(r=a(o,"touchmove",(e=>{O(e)}),{passive:!1})),o.style.overflow="hidden",l.value=!0)})():s()}})},exports.useSwipe=function(e,n={}){const{threshold:o=50,onSwipe:l,onSwipeEnd:r,onSwipeStart:u,passive:s=!0}=n,i=t.reactive({x:0,y:0}),c=t.reactive({x:0,y:0}),d=t.computed((()=>i.x-c.x)),f=t.computed((()=>i.y-c.y)),{max:v,abs:p}=Math,m=t.computed((()=>v(p(d.value),p(f.value))>=o)),h=t.shallowRef(!1),w=t.computed((()=>m.value?p(d.value)>p(f.value)?d.value>0?"left":"right":f.value>0?"up":"down":"none")),g=e=>[e.touches[0].clientX,e.touches[0].clientY],y=(e,t)=>{c.x=e,c.y=t},b={passive:s,capture:!s},S=[a(e,"touchstart",(e=>{if(1!==e.touches.length)return;const[t,n]=g(e);((e,t)=>{i.x=e,i.y=t})(t,n),y(t,n),null==u||u(e)}),b),a(e,"touchmove",(e=>{if(1!==e.touches.length)return;const[t,n]=g(e);y(t,n),b.capture&&!b.passive&&Math.abs(d.value)>Math.abs(f.value)&&e.preventDefault(),!h.value&&m.value&&(h.value=!0),h.value&&(null==l||l(e))}),b),a(e,["touchend","touchcancel"],(e=>{h.value&&(null==r||r(e,w.value)),h.value=!1}),b)];return{isSwiping:h,direction:w,coordsStart:i,coordsEnd:c,lengthX:d,lengthY:f,stop:()=>S.forEach((e=>e())),isPassiveEventSupported:!0}},exports.useTimestamp=function(n={}){const{controls:l=!1,offset:a=0,immediate:r=!0,interval:u="requestAnimationFrame",callback:s}=n,i=t.shallowRef(e.timestamp()+a),c=()=>i.value=e.timestamp()+a,d=s?()=>{c(),s(i.value)}:c,f="requestAnimationFrame"===u?function(n,l={}){const{immediate:a=!0,fpsLimit:r,window:u=o,once:s=!1}=l,i=t.shallowRef(!1),c=t.computed((()=>r?1e3/t.toValue(r):null));let d=0,f=null;function v(e){if(!i.value||!u)return;d||(d=e);const t=e-d;if(c.value&&t<c.value)f=u.requestAnimationFrame(v);else{if(d=e,n({delta:t,timestamp:e}),s)return i.value=!1,void(f=null);f=u.requestAnimationFrame(v)}}function p(){!i.value&&u&&(i.value=!0,d=0,f=u.requestAnimationFrame(v))}function m(){i.value=!1,null!=f&&u&&(u.cancelAnimationFrame(f),f=null)}return a&&p(),e.tryOnScopeDispose(m),{isActive:t.readonly(i),pause:m,resume:p}}(d,{immediate:r}):e.useIntervalFn(d,u,{immediate:r});return l?{timestamp:i,...f}:i};
//# sourceMappingURL=index-DiURjA3G.js.map
;