@stonecrop/utilities 0.2.5

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,2 @@
1
+ (function(u,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],a):(u=typeof globalThis<"u"?globalThis:u||self,a(u["@stonecrop/utilities"]={},u.Vue))})(this,function(u,a){"use strict";var O;const P=typeof window<"u",U=e=>typeof e=="string",B=()=>{};P&&((O=window==null?void 0:window.navigator)!=null&&O.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function _(e){return typeof e=="function"?e():a.unref(e)}function V(e){return e}function W(e){return a.getCurrentScope()?(a.onScopeDispose(e),!0):!1}function $(e){var t;const r=_(e);return(t=r==null?void 0:r.$el)!=null?t:r}const I=P?window:void 0;function j(...e){let t,r,n,o;if(U(e[0])||Array.isArray(e[0])?([r,n,o]=e,t=I):[t,r,n,o]=e,!t)return B;Array.isArray(r)||(r=[r]),Array.isArray(n)||(n=[n]);const s=[],l=()=>{s.forEach(c=>c()),s.length=0},f=(c,y,g,i)=>(c.addEventListener(y,g,i),()=>c.removeEventListener(y,g,i)),T=a.watch(()=>[$(t),_(o)],([c,y])=>{l(),c&&s.push(...r.flatMap(g=>n.map(i=>f(c,g,i,y))))},{immediate:!0,flush:"post"}),m=()=>{T(),l()};return W(m),m}const A=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},S="__vueuse_ssr_handlers__";A[S]=A[S]||{};function q(e,{window:t=I,scrollTarget:r}={}){const n=a.ref(!1),o=()=>{if(!t)return;const s=t.document,l=$(e);if(!l)n.value=!1;else{const f=l.getBoundingClientRect();n.value=f.top<=(t.innerHeight||s.documentElement.clientHeight)&&f.left<=(t.innerWidth||s.documentElement.clientWidth)&&f.bottom>=0&&f.right>=0}};return a.watch(()=>$(e),()=>o(),{immediate:!0,flush:"post"}),t&&j(r||t,"scroll",o,{capture:!1,passive:!0}),n}var k;(function(e){e.UP="UP",e.RIGHT="RIGHT",e.DOWN="DOWN",e.LEFT="LEFT",e.NONE="NONE"})(k||(k={}));var F=Object.defineProperty,x=Object.getOwnPropertySymbols,G=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable,L=(e,t,r)=>t in e?F(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,J=(e,t)=>{for(var r in t||(t={}))G.call(t,r)&&L(e,r,t[r]);if(x)for(var r of x(t))z.call(t,r)&&L(e,r,t[r]);return e};J({linear:V},{easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]});const p=e=>{let t=q(e).value;return t=t&&e.offsetHeight>0,t},d=e=>e.tabIndex>=0,R=e=>{const t=e.target;return E(t)},E=e=>{var r;let t;if(e instanceof HTMLTableCellElement){const n=(r=e.parentElement)==null?void 0:r.previousElementSibling;if(n){const s=Array.from(n.children)[e.cellIndex];s&&(t=s)}}else if(e instanceof HTMLTableRowElement){const n=e.previousElementSibling;n&&(t=n)}return t&&(!d(t)||!p(t))?E(t):t},X=e=>{var n;const t=e.target;let r;if(t instanceof HTMLTableCellElement){const o=(n=t.parentElement)==null?void 0:n.parentElement;if(o){const l=o.firstElementChild.children[t.cellIndex];l&&(r=l)}}else if(t instanceof HTMLTableRowElement){const o=t.parentElement;if(o){const s=o.firstElementChild;s&&(r=s)}}return r&&(!d(r)||!p(r))?h(r):r},D=e=>{const t=e.target;return h(t)},h=e=>{var r;let t;if(e instanceof HTMLTableCellElement){const n=(r=e.parentElement)==null?void 0:r.nextElementSibling;if(n){const s=Array.from(n.children)[e.cellIndex];s&&(t=s)}}else if(e instanceof HTMLTableRowElement){const n=e.nextElementSibling;n&&(t=n)}return t&&(!d(t)||!p(t))?h(t):t},Y=e=>{var n;const t=e.target;let r;if(t instanceof HTMLTableCellElement){const o=(n=t.parentElement)==null?void 0:n.parentElement;if(o){const l=o.lastElementChild.children[t.cellIndex];l&&(r=l)}}else if(t instanceof HTMLTableRowElement){const o=t.parentElement;if(o){const s=o.lastElementChild;s&&(r=s)}}return r&&(!d(r)||!p(r))?E(r):r},M=e=>{const t=e.target;return w(t)},w=e=>{var r;let t;if(e.previousElementSibling)t=e.previousElementSibling;else{const n=(r=e.parentElement)==null?void 0:r.previousElementSibling;t=n==null?void 0:n.lastElementChild}return t&&(!d(t)||!p(t))?w(t):t},H=e=>{const t=e.target;return b(t)},b=e=>{var r;let t;if(e.nextElementSibling)t=e.nextElementSibling;else{const n=(r=e.parentElement)==null?void 0:r.nextElementSibling;t=n==null?void 0:n.firstElementChild}return t&&(!d(t)||!p(t))?b(t):t},N=e=>{const n=e.target.parentElement.firstElementChild;return n&&(!d(n)||!p(n))?b(n):n},K=e=>{const n=e.target.parentElement.lastElementChild;return n&&(!d(n)||!p(n))?w(n):n},C=["alt","control","shift","meta"],Z={ArrowUp:"up",ArrowDown:"down",ArrowLeft:"left",ArrowRight:"right"},Q={"keydown.up":e=>{const t=R(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())},"keydown.down":e=>{const t=D(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())},"keydown.left":e=>{const t=M(e);e.preventDefault(),e.stopPropagation(),t&&t.focus()},"keydown.right":e=>{const t=H(e);e.preventDefault(),e.stopPropagation(),t&&t.focus()},"keydown.control.up":e=>{const t=X(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())},"keydown.control.down":e=>{const t=Y(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())},"keydown.control.left":e=>{const t=N(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())},"keydown.control.right":e=>{const t=K(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())},"keydown.end":e=>{const t=K(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())},"keydown.enter":e=>{if(e.target instanceof HTMLTableCellElement){e.preventDefault(),e.stopPropagation();const r=D(e);r&&r.focus()}},"keydown.shift.enter":e=>{if(e.target instanceof HTMLTableCellElement){e.preventDefault(),e.stopPropagation();const r=R(e);r&&r.focus()}},"keydown.home":e=>{const t=N(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())},"keydown.tab":e=>{const t=H(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())},"keydown.shift.tab":e=>{const t=M(e);t&&(e.preventDefault(),e.stopPropagation(),t.focus())}};function ee(e){const t=n=>{let o=null;n.parent&&(typeof n.parent=="string"?o=document.querySelector(n.parent):n.parent instanceof Element?o=n.parent:o=n.parent.value);let s=[];if(n.selectors)if(typeof n.selectors=="string")s=o?Array.from(o.querySelectorAll(n.selectors)):Array.from(document.querySelectorAll(n.selectors));else if(n.selectors instanceof Element)s.push(n.selectors);else if(Array.isArray(n.selectors.value))for(const l of n.selectors.value)l instanceof Element?s.push(l):s.push(l.$el);else s.push(n.selectors.value);else s=Array.from(o.children).filter(f=>d(f)&&p(f));return s},r=n=>o=>{const s=Z[o.key]||o.key.toLowerCase();if(C.includes(s))return;const l=n.handlers||Q;for(const f of Object.keys(l)){const[T,...m]=f.split(".");if(T==="keydown"&&m.includes(s)){const c=l[f],y=m.filter(i=>C.includes(i)),g=C.some(i=>{const v=i.charAt(0).toUpperCase()+i.slice(1);return o.getModifierState(v)});if(y.length>0){if(g){for(const i of C)if(m.includes(i)){const v=i.charAt(0).toUpperCase()+i.slice(1);o.getModifierState(v)&&c(o)}}}else g||c(o)}}};a.onMounted(()=>{for(const n of e){const o=t(n);for(const s of o)s.addEventListener("keydown",r(n))}}),a.onBeforeUnmount(()=>{for(const n of e){const o=t(n);for(const s of o)s.removeEventListener("keydown",r(n))}})}function te(e){}u.defaultKeypressHandlers=Q,u.install=te,u.useKeyboardNav=ee,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
2
+ //# sourceMappingURL=utilities.umd.cjs.map