UNPKG

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 kB
"use strict";const e=require("./index-CDlPJrTO.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 r(...n){const r=[],a=()=>{r.forEach(e=>e()),r.length=0},s=t.computed(()=>{const o=e.toArray(t.toValue(n[0])).filter(e=>null!=e);return o.every(e=>"string"!=typeof e)?o:void 0}),u=e.watchImmediate(()=>{var r,a;return[null!=(a=null==(r=s.value)?void 0:r.map(e=>l(e)))?a:[o].filter(e=>null!=e),e.toArray(t.toValue(s.value?n[1]:n[0])),e.toArray(t.unref(s.value?n[2]:n[1])),t.toValue(s.value?n[3]:n[2])]},([t,n,o,l])=>{if(a(),!(null==t?void 0:t.length)||!(null==n?void 0:n.length)||!(null==o?void 0:o.length))return;const s=e.isObject(l)?{...l}:l;r.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,s)))))},{flush:"post"});return e.tryOnScopeDispose(a),()=>{u(),a()}}let a=!1;function s(){const e=t.shallowRef(!1),n=t.getCurrentInstance();return n&&t.onMounted(()=>{e.value=!0},n),e}function u(e){const n=s();return t.computed(()=>(n.value,Boolean(e())))}function i(n,r,a={}){const{window:s=o,...i}=a;let c;const d=u(()=>s&&"MutationObserver"in s),f=()=>{c&&(c.disconnect(),c=void 0)},v=t.computed(()=>{const o=t.toValue(n),r=e.toArray(o).map(l).filter(e.notNullish);return new Set(r)}),p=t.watch(()=>v.value,e=>{f(),d.value&&e.size&&(c=new MutationObserver(r),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 c=Symbol("vueuse-ssr-width");function d(){const n=t.hasInjectionContext()?e.injectLocal(c,null):null;return"number"==typeof n?n:void 0}function f(n,l={}){const{window:a=o,ssrWidth:s=d()}=l,i=u(()=>a&&"matchMedia"in a&&"function"==typeof a.matchMedia),c=t.shallowRef("number"==typeof s),f=t.shallowRef(),v=t.shallowRef(!1);return t.watchEffect(()=>{if(c.value){c.value=!i.value;const o=t.toValue(n).split(",");return void(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 r=Boolean(o||l);return o&&r&&(r=s>=e.pxValue(o[1])),l&&r&&(r=s<=e.pxValue(l[1])),n?!r:r}))}i.value&&(f.value=a.matchMedia(t.toValue(n)),v.value=f.value.matches)}),r(f,"change",e=>{v.value=e.matches},{passive:!0}),t.computed(()=>v.value)}const v="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},p="__vueuse_ssr_handlers__",m=h();function h(){return p in v||(v[p]=v[p]||{}),v[p]}function w(e,t){return m[e]||t}function g(e){return f("(prefers-color-scheme: dark)",e)}const y={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()}},b="vueuse-storage";function S(n,l,a,s={}){var u;const{flush:i="pre",deep:c=!0,listenToStorageChanges:d=!0,writeDefaults:f=!0,mergeDefaults:v=!1,shallow:p,window:m=o,eventFilter:h,onError:g=e=>{console.error(e)},initOnMounted:S}=s,x=(p?t.shallowRef:t.ref)("function"==typeof l?l():l),E=t.computed(()=>t.toValue(n));if(!a)try{a=w("getDefaultStorage",()=>{var e;return null==(e=o)?void 0:e.localStorage})()}catch(I){g(I)}if(!a)return x;const O=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"}(O),A=null!=(u=s.serializer)?u:y[V],{pause:k,resume:M}=e.watchPausable(x,()=>function(e){try{const t=a.getItem(E.value);if(null==e)T(t,null),a.removeItem(E.value);else{const n=A.write(e);t!==n&&(a.setItem(E.value,n),T(t,n))}}catch(I){g(I)}}(x.value),{flush:i,deep:c,eventFilter:h});t.watch(E,()=>D(),{flush:i});let R=!1;const N=e=>{S&&!R||D(e.detail)};function T(e,t){if(m){const n={key:E.value,oldValue:e,newValue:t,storageArea:a};m.dispatchEvent(a instanceof Storage?new StorageEvent("storage",n):new CustomEvent(b,{detail:n}))}}function D(e){if(!e||e.storageArea===a)if(e&&null==e.key)x.value=O;else if(!e||e.key===E.value){k();try{(null==e?void 0:e.newValue)!==A.write(x.value)&&(x.value=function(e){const t=e?e.newValue:a.getItem(E.value);if(null==t)return f&&null!=O&&a.setItem(E.value,A.write(O)),O;if(!e&&v){const e=A.read(t);return"function"==typeof v?v(e,O):"object"!==V||Array.isArray(e)?e:{...O,...e}}return"string"!=typeof t?t:A.read(t)}(e))}catch(I){g(I)}finally{e?t.nextTick(M):M()}}}return m&&d&&(a instanceof Storage?r(m,"storage",e=>{S&&!R||D(e)},{passive:!0}):r(m,b,N)),S?e.tryOnMounted(()=>{R=!0,D()}):D(),x}function x(e){return"undefined"!=typeof Window&&e instanceof Window?e.document.documentElement:"undefined"!=typeof Document&&e instanceof Document?e.documentElement:e}const E={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 O(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)&&O(t)}}function V(e){const t=e||window.event;return!O(t.target)&&(t.touches.length>1||(t.preventDefault&&t.preventDefault(),!1))}const A=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,r=t.shallowRef(),a=t.defineComponent({setup:(e,{slots:t})=>()=>{r.value=t.default}}),s=t.defineComponent({inheritAttrs:l,props:o.props,setup:(e,{attrs:t,slots:a})=>()=>{var s;if(!r.value&&"production"!==process.env.NODE_ENV)throw new Error("[VueUse] Failed to find the definition of reusable template");const u=null==(s=r.value)?void 0:s.call(r,{...null==o.props?n(t):e,$slots:a});return l&&1===(null==u?void 0:u.length)?u[0]:u}});return e.makeDestructurable({define:a,reuse:s},[a,s])},exports.getSSRHandler=w,exports.onClickOutside=function(n,s,u={}){const{window:i=o,ignore:c=[],capture:d=!0,detectIframe:f=!1,controls:v=!1}=u;if(!i)return v?{stop:e.noop,cancel:e.noop,trigger:e.noop}:e.noop;if(e.isIOS&&!a){a=!0;const t={passive:!0};Array.from(i.document.body.children).forEach(n=>n.addEventListener("click",e.noop,t)),i.document.documentElement.addEventListener("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?s(e):p=!0)};let w=!1;const g=[r(i,"click",e=>{w||(w=!0,setTimeout(()=>{w=!1},0),h(e))},{passive:!0,capture:d}),r(i,"pointerdown",e=>{const t=l(n);p=!m(e)&&!(!t||e.composedPath().includes(t))},{passive:!0}),f&&r(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))||s(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,a={};3===e.length?(n=e[0],l=e[1],a=e[2]):2===e.length?"object"==typeof e[1]?(n=!0,l=e[0],a=e[1]):(n=e[0],l=e[1]):(n=!0,l=e[0]);const{target:s=o,eventName:u="keydown",passive:i=!1,dedupe:c=!1}=a,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 r(s,u,e=>{e.repeat&&t.toValue(c)||d(e)&&l(e)},i)},exports.unrefElement=l,exports.useBreakpoints=function(n,l={}){function r(o,l){let r=t.toValue(n[t.toValue(o)]);return null!=l&&(r=e.increaseWithUnit(r,l)),"number"==typeof r&&(r=`${r}px`),r}const{window:a=o,strategy:s="min-width",ssrWidth:u=d()}=l,i="number"==typeof u,c=i?t.shallowRef(!1):{value:!0};function v(t,n){return!c.value&&i?"min"===t?u>=e.pxValue(n):u<=e.pxValue(n):!!a&&a.matchMedia(`(${t}-width: ${n})`).matches}i&&e.tryOnMounted(()=>c.value=!!a);const p=e=>f(()=>`(min-width: ${r(e)})`,l),m=e=>f(()=>`(max-width: ${r(e)})`,l),h=Object.keys(n).reduce((e,t)=>(Object.defineProperty(e,t,{get:()=>"min-width"===s?p(t):m(t),enumerable:!0,configurable:!0}),e),{});function w(){const o=Object.keys(n).map(t=>[t,h[t],e.pxValue(r(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=>f(()=>`(min-width: ${r(e,.1)})`,l),smaller:e=>f(()=>`(max-width: ${r(e,-.1)})`,l),between:(e,t)=>f(()=>`(min-width: ${r(e)}) and (max-width: ${r(t,-.1)})`,l),isGreater:e=>v("min",r(e,.1)),isGreaterOrEqual:e=>v("min",r(e)),isSmaller:e=>v("max",r(e,-.1)),isSmallerOrEqual:e=>v("max",r(e)),isInBetween:(e,t)=>v("min",r(e))&&v("max",r(t,-.1)),current:w,active(){const e=w();return t.computed(()=>0===e.value.length?"":e.value.at("min-width"===s?-1:0))}})},exports.useColorMode=function(n={}){const{selector:r="html",attribute:a="class",initialValue:s="auto",window:u=o,storage:i,storageKey:c="vueuse-color-scheme",listenToStorageChanges:d=!0,storageRef:f,emitAuto:v,disableTransition:p=!0}=n,m={auto:"",light:"light",dark:"dark",...n.modes||{}},h=g({window:u}),y=t.computed(()=>h.value?"dark":"light"),b=f||(null==c?e.toRef(s):S(c,s,i,{window:u,listenToStorageChanges:d})),x=t.computed(()=>"auto"===b.value?y.value:b.value),E=w("updateHTMLAttrs",(e,t,n)=>{const o="string"==typeof e?null==u?void 0:u.document.querySelector(e):l(e);if(!o)return;const r=new Set,a=new Set;let s,i=null;if("class"===t){const e=n.split(/\s/g);Object.values(m).flatMap(e=>(e||"").split(/\s/g)).filter(Boolean).forEach(t=>{e.includes(t)?r.add(t):a.add(t)})}else i={key:t,value:n};if(0!==r.size||0!==a.size||null!==i){p&&(s=u.document.createElement("style"),s.appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),u.document.head.appendChild(s));for(const e of r)o.classList.add(e);for(const e of a)o.classList.remove(e);i&&o.setAttribute(i.key,i.value),p&&(u.getComputedStyle(s).opacity,document.head.removeChild(s))}});function O(e){var t;E(r,a,null!=(t=m[e])?t:e)}function V(e){n.onChanged?n.onChanged(e,O):O(e)}t.watch(x,V,{flush:"post",immediate:!0}),e.tryOnMounted(()=>V(x.value));const A=t.computed({get:()=>v?b.value:x.value,set(e){b.value=e}});return Object.assign(A,{store:b,system:y,state:x})},exports.useElementHover=function(n,a={}){const{delayEnter:s=0,delayLeave:u=0,triggerOnRemoval:c=!1,window:d=o}=a,f=t.shallowRef(!1);let v;const p=e=>{const t=e?s:u;v&&(clearTimeout(v),v=void 0),t?v=setTimeout(()=>f.value=e,t):f.value=e};return d?(r(n,"mouseenter",()=>p(!0),{passive:!0}),r(n,"mouseleave",()=>p(!1),{passive:!0}),c&&function(n,r,a={}){const{window:s=o,document:u=(null==s?void 0:s.document),flush:c="sync"}=a;if(!s||!u)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}=i(u,t=>{t.map(e=>[...e.removedNodes]).flat().some(t=>t===e||t.contains(e))&&r(t)},{window:s,childList:!0,subtree:!0});f(t)}},{flush:c}),p=()=>{v(),f()};e.tryOnScopeDispose(p)}(t.computed(()=>l(n)),()=>p(!1)),f):f},exports.useEventListener=r,exports.useFocus=function(e,n={}){const{initialValue:o=!1,focusVisible:a=!1,preventScroll:s=!1}=n,u=t.shallowRef(!1),i=t.computed(()=>l(e)),c={passive:!0};r(i,"focus",e=>{var t,n;a&&!(null==(n=(t=e.target).matches)?void 0:n.call(t,":focus-visible"))||(u.value=!0)},c),r(i,"blur",()=>u.value=!1,c);const d=t.computed({get:()=>u.value,set(e){var t,n;!e&&u.value?null==(t=i.value)||t.blur():e&&!u.value&&(null==(n=i.value)||n.focus({preventScroll:s}))}});return t.watch(i,()=>{d.value=o},{immediate:!0,flush:"post"}),{focused:d}},exports.useIntersectionObserver=function(n,r,a={}){const{root:s,rootMargin:i="0px",threshold:c=0,window:d=o,immediate:f=!0}=a,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(r,{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:a=!1,initialValue:s={x:0,y:0},window:u=o,target:i=u,scroll:c=!0,eventFilter:d}=e;let f=null,v=0,p=0;const m=t.shallowRef(s.x),h=t.shallowRef(s.y),w=t.shallowRef(null),g="function"==typeof n?n:E[n],y=e=>{const t=g(e);f=e,t&&([m.value,h.value]=t,w.value="mouse"),u&&(v=u.scrollX,p=u.scrollY)},b=e=>{if(e.touches.length>0){const t=g(e.touches[0]);t&&([m.value,h.value]=t,w.value="touch")}},S=()=>{if(!f||!u)return;const e=g(f);f instanceof MouseEvent&&e&&(m.value=e[0]+u.scrollX-v,h.value=e[1]+u.scrollY-p)},x=()=>{m.value=s.x,h.value=s.y},O=d?e=>d(()=>y(e),{}):e=>y(e),V=d?e=>d(()=>b(e),{}):e=>b(e),A=d?()=>d(()=>S(),{}):()=>S();if(i){const e={passive:!0};r(i,["mousemove","dragover"],O,e),l&&"movement"!==n&&(r(i,["touchstart","touchmove"],V,e),a&&r(i,"touchend",x,e)),c&&"page"===n&&r(u,"scroll",A,e)}return{x:m,y:h,sourceType:w}},exports.useMutationObserver=i,exports.useScrollLock=function(n,o=!1){const l=t.shallowRef(o);let a=null,s="";t.watch(e.toRef(n),e=>{const n=x(t.toValue(e));if(n){const e=n;if(A.get(e)||A.set(e,e.style.overflow),"hidden"!==e.style.overflow&&(s=e.style.overflow),"hidden"===e.style.overflow)return l.value=!0;if(l.value)return e.style.overflow="hidden"}},{immediate:!0});const u=()=>{const o=x(t.toValue(n));o&&l.value&&(e.isIOS&&(null==a||a()),o.style.overflow=s,A.delete(o),l.value=!1)};return e.tryOnScopeDispose(u),t.computed({get:()=>l.value,set(o){o?(()=>{const o=x(t.toValue(n));o&&!l.value&&(e.isIOS&&(a=r(o,"touchmove",e=>{V(e)},{passive:!1})),o.style.overflow="hidden",l.value=!0)})():u()}})},exports.useSwipe=function(e,n={}){const{threshold:o=50,onSwipe:l,onSwipeEnd:a,onSwipeStart:s,passive:u=!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:u,capture:!u},S=[r(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==s||s(e)},b),r(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),r(e,["touchend","touchcancel"],e=>{h.value&&(null==a||a(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:r=0,immediate:a=!0,interval:s="requestAnimationFrame",callback:u}=n,i=t.shallowRef(e.timestamp()+r),c=()=>i.value=e.timestamp()+r,d=u?()=>{c(),u(i.value)}:c,f="requestAnimationFrame"===s?function(n,l={}){const{immediate:r=!0,fpsLimit:a,window:s=o,once:u=!1}=l,i=t.shallowRef(!1),c=t.computed(()=>a?1e3/t.toValue(a):null);let d=0,f=null;function v(e){if(!i.value||!s)return;d||(d=e);const t=e-d;if(c.value&&t<c.value)f=s.requestAnimationFrame(v);else{if(d=e,n({delta:t,timestamp:e}),u)return i.value=!1,void(f=null);f=s.requestAnimationFrame(v)}}function p(){!i.value&&s&&(i.value=!0,d=0,f=s.requestAnimationFrame(v))}function m(){i.value=!1,null!=f&&s&&(s.cancelAnimationFrame(f),f=null)}return r&&p(),e.tryOnScopeDispose(m),{isActive:t.readonly(i),pause:m,resume:p}}(d,{immediate:a}):e.useIntervalFn(d,s,{immediate:a});return l?{timestamp:i,...f}:i}; //# sourceMappingURL=index-BwrAUj83.js.map