Socket
Socket
Sign inDemoInstall

@zag-js/popper

Package Overview
Dependencies
Maintainers
1
Versions
883
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zag-js/popper - npm Package Compare versions

Comparing version 0.0.0-dev-20220412162814 to 0.0.0-dev-20220412212252

2

dist/index.js

@@ -1,2 +0,2 @@

var E=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames,T=Object.getOwnPropertySymbols;var O=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable;var M=(e,t,n)=>t in e?E(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,z=(e,t)=>{for(var n in t||(t={}))O.call(t,n)&&M(e,n,t[n]);if(T)for(var n of T(t))$.call(t,n)&&M(e,n,t[n]);return e};var K=e=>E(e,"__esModule",{value:!0});var Y=(e,t)=>{for(var n in t)E(e,n,{get:t[n],enumerable:!0})},X=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of _(t))!O.call(e,l)&&(n||l!=="default")&&E(e,l,{get:()=>t[l],enumerable:!(r=B(t,l))||r.enumerable});return e};var Z=(e=>(t,n)=>e&&e.get(t)||(n=X(K({}),t,1),e&&e.set(t,n),n))(typeof WeakMap!="undefined"?new WeakMap:0);var ae={};Y(ae,{getPlacement:()=>q,getPlacementStyles:()=>W});var f=require("@floating-ui/dom");var G=()=>{};var ue=(()=>{let e=0;return()=>(e++,e.toString(36))})();var g=new Map,v=new Map;function J(e,t,n,r){var l;if(!e)return G;let i=JSON.stringify({type:t,options:r}),c=g.get(e);if(g.has(e))(c==null?void 0:c.has(i))?(l=c==null?void 0:c.get(i))==null||l.add(n):c==null||c.set(i,new Set([n]));else{let o=new Map([[i,new Set([n])]]);g.set(e,o)}function m(o){var p,d;function a(s){var y;let P=g.get(o);(y=P==null?void 0:P.get(i))==null||y.forEach(U=>U(s))}if(!(v==null?void 0:v.has(o))){v.set(o,new Map([[i,a]])),o.addEventListener(t,a,r);return}((p=v==null?void 0:v.get(o))==null?void 0:p.has(i))||((d=v.get(o))==null||d.set(i,a),o.addEventListener(t,a,r))}return m(e),function(){var o,p,d,a;if(!g.has(e))return;let s=g.get(e);if((o=s==null?void 0:s.get(i))==null||o.delete(n),((p=s==null?void 0:s.get(i))==null?void 0:p.size)===0){let y=(d=v.get(e))==null?void 0:d.get(i);e.removeEventListener(t,y,r),s==null||s.delete(i),(a=v.get(e))==null||a.delete(i),(s==null?void 0:s.size)===0&&(g.delete(e),v.delete(e))}}}var R=e=>Object.prototype.toString.call(e).slice(8,-1),Q=e=>R(e)==="Object"&&"current"in e,ee=e=>R(e)==="Function"?e():e;function x(e,t,n,r){let l=Q(e)?e.current:ee(e);return J(l,t,n,r)}function C(e){var t;return te(e)?e.document:(t=e==null?void 0:e.ownerDocument)!=null?t:document}function L(e){return typeof e=="object"&&(e==null?void 0:e.nodeType)===Node.ELEMENT_NODE&&typeof(e==null?void 0:e.nodeName)=="string"}function te(e){return(e==null?void 0:e.toString())==="[object Window]"}var ce=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","embed","iframe","object","a[href]","area[href]","[tabindex]","audio[controls]","video[controls]","*[tabindex]:not([aria-disabled])","[contenteditable]:not([contenteditable=false])","details > summary:first-of-type"].join(",");var h=new Map;function k(e,t){let n=h.get(e);return n?(n.callbacks.push(t),t(e.getBoundingClientRect())):(h.set(e,{rect:{},callbacks:[t]}),h.size===1&&(A=requestAnimationFrame(H))),function(){let r=h.get(e);if(!r)return;let l=r.callbacks.indexOf(t);l>-1&&r.callbacks.splice(l,1),r.callbacks.length===0&&(h.delete(e),h.size===0&&cancelAnimationFrame(A))}}var A;function H(){let e=[];h.forEach((t,n)=>{let r=n.getBoundingClientRect();ne(t.rect,r)||(t.rect=r,e.push(t))}),e.forEach(t=>{t.callbacks.forEach(n=>n(t.rect))}),A=requestAnimationFrame(H)}function ne(e,t){return e.width===t.width&&e.height===t.height&&e.top===t.top&&e.right===t.right&&e.bottom===t.bottom&&e.left===t.left}var S=()=>{},b=(...e)=>t=>e.reduce((n,r)=>r(n),t);var fe=(()=>{let e=0;return()=>(e++,e.toString(36))})();var I=e=>e===!0||e===!1;var D=require("@floating-ui/dom");function re(e){return I(e)?{ancestorResize:e,ancestorScroll:e,referenceResize:e}:Object.assign({ancestorResize:!0,ancestorScroll:!0,referenceResize:!0},e)}function V(e,t,n,r=!1){let{ancestorScroll:l,ancestorResize:i,referenceResize:c}=re(r),m=l||i,o=[];m&&L(e)&&o.push(...(0,D.getOverflowAncestors)(e));function p(){let a=[k(t,n)];return c&&L(e)&&a.push(k(e,n)),a.push(b(...o.map(s=>x(s,"resize",n)))),()=>a.forEach(s=>s())}function d(){return b(...o.map(a=>x(a,"scroll",n,{passive:!0})))}return b(p(),d())}var w=e=>({variable:e,reference:`var(${e})`}),u={arrowShadowColor:w("--arrow-shadow-color"),arrowSize:w("--arrow-size"),arrowSizeHalf:w("--arrow-size-half"),arrowBg:w("--arrow-background"),transformOrigin:w("--transform-origin"),arrowOffset:w("--arrow-offset"),boxShadow:w("--arrow-box-shadow")},F={top:"bottom center","top-start":"bottom left","top-end":"bottom right",bottom:"top center","bottom-start":"top left","bottom-end":"top right",left:"right center","left-start":"right top","left-end":"right bottom",right:"left center","right-start":"left top","right-end":"left bottom"},j={name:"transformOrigin",fn({placement:e,elements:t}){let{floating:n}=t;return n.style.setProperty(u.transformOrigin.variable,F[e]),{data:{transformOrigin:F[e]}}}},N=e=>({name:"shiftArrow",fn({placement:t,middlewareData:n}){var m;let{element:r}=e,{x:l,y:i}=(m=n.arrow)!=null?m:{x:0,y:0},c={top:"bottom",right:"left",bottom:"top",left:"right"}[t.split("-")[0]];return Object.assign(r.style,{top:`${i}px`,left:`${l}px`,[c]:u.arrowOffset.reference,[u.boxShadow.variable]:oe(t)}),{}}});function oe(e){if(e.includes("top"))return`1px 1px 1px 0 ${u.arrowShadowColor.reference}`;if(e.includes("bottom"))return`-1px -1px 1px 0 ${u.arrowShadowColor.reference}`;if(e.includes("right"))return`-1px 1px 1px 0 ${u.arrowShadowColor.reference}`;if(e.includes("left"))return`1px -1px 1px 0 ${u.arrowShadowColor.reference}`}var ie={strategy:"absolute",placement:"bottom",listeners:!0,gutter:8,flip:!0,sameWidth:!1};function q(e,t,n={}){var m;if(e==null||t==null)return S;n=Object.assign({},ie,n);let r=[j];if(n.flip&&r.push((0,f.flip)({boundary:n.boundary,padding:8})),n.gutter||n.offset){let o=n.gutter?{mainAxis:n.gutter}:n.offset;r.push((0,f.offset)(o))}r.push((0,f.shift)({boundary:n.boundary}));let i=C(t).querySelector("[data-part=arrow]");i&&r.push((0,f.arrow)({element:i,padding:8}),N({element:i})),n.sameWidth&&r.push((0,f.size)({apply(o){let{width:p}=o.reference;Object.assign(t.style,{width:`${p}px`,minWidth:"unset"})}}));function c(){if(e==null||t==null)return;let{placement:o,strategy:p}=n;(0,f.computePosition)(e,t,{placement:o,middleware:r,strategy:p}).then(d=>{let{x:a,y:s,strategy:y}=d;return Object.assign(t.style,{left:`${a}px`,top:`${s}px`,position:y}),d}).then(d=>{var a;(a=n.onComplete)==null||a.call(n,d)})}return c(),b(V(e,t,c,n.listeners),(m=n.onCleanup)!=null?m:S)}var le={position:"fixed",top:0,left:0,opacity:0,transform:"translate3d(0, -200%, 0)",pointerEvents:"none"};function W(e){let{measured:t,strategy:n="absolute"}=e;return{arrow:{position:"absolute",width:u.arrowSize.reference,height:u.arrowSize.reference,[u.arrowSizeHalf.variable]:`calc(${u.arrowSize.reference} / 2)`,[u.arrowOffset.variable]:`calc(${u.arrowSizeHalf.reference} * -1)`,opacity:t?void 0:0},innerArrow:{transform:"rotate(45deg)",background:u.arrowBg.reference,top:"0",left:"0",width:"100%",height:"100%",position:"absolute",zIndex:"inherit"},floating:z({position:n,minWidth:"max-content"},!t&&le)}}module.exports=Z(ae);
var et=Object.defineProperty;var Ut=Object.getOwnPropertyDescriptor;var qt=Object.getOwnPropertyNames;var $t=Object.prototype.hasOwnProperty;var Kt=(t,e)=>{for(var n in e)et(t,n,{get:e[n],enumerable:!0})},Yt=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of qt(e))!$t.call(t,r)&&r!==n&&et(t,r,{get:()=>e[r],enumerable:!(o=Ut(e,r))||o.enumerable});return t};var Xt=t=>Yt(et({},"__esModule",{value:!0}),t);var Se={};Kt(Se,{getPlacement:()=>Ft,getPlacementStyles:()=>Bt});module.exports=Xt(Se);function H(t){return t.split("-")[0]}function Y(t){return t.split("-")[1]}function B(t){return["top","bottom"].includes(H(t))?"x":"y"}function ot(t){return t==="y"?"height":"width"}function vt(t,e,n){let{reference:o,floating:r}=t,l=o.x+o.width/2-r.width/2,s=o.y+o.height/2-r.height/2,c=B(e),i=ot(c),u=o[i]/2-r[i]/2,d=H(e),a=c==="x",f;switch(d){case"top":f={x:l,y:o.y-r.height};break;case"bottom":f={x:l,y:o.y+o.height};break;case"right":f={x:o.x+o.width,y:s};break;case"left":f={x:o.x-r.width,y:s};break;default:f={x:o.x,y:o.y}}switch(Y(e)){case"start":f[c]-=u*(n&&a?-1:1);break;case"end":f[c]+=u*(n&&a?-1:1);break}return f}var bt=async(t,e,n)=>{let{placement:o="bottom",strategy:r="absolute",middleware:l=[],platform:s}=n,c=await(s.isRTL==null?void 0:s.isRTL(e)),i=await s.getElementRects({reference:t,floating:e,strategy:r}),{x:u,y:d}=vt(i,o,c),a=o,f={},m=0;for(let p=0;p<l.length;p++){let{name:w,fn:v}=l[p],{x:g,y:h,data:y,reset:x}=await v({x:u,y:d,initialPlacement:o,placement:a,strategy:r,middlewareData:f,rects:i,platform:s,elements:{reference:t,floating:e}});if(u=g??u,d=h??d,f={...f,[w]:{...f[w],...y}},x){typeof x=="object"&&(x.placement&&(a=x.placement),x.rects&&(i=x.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:r}):x.rects),{x:u,y:d}=vt(i,a,c)),p=-1;continue}}return{x:u,y:d,placement:a,strategy:r,middlewareData:f}};function Jt(t){return{top:0,right:0,bottom:0,left:0,...t}}function xt(t){return typeof t!="number"?Jt(t):{top:t,right:t,bottom:t,left:t}}function F(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}async function X(t,e){var n;e===void 0&&(e={});let{x:o,y:r,platform:l,rects:s,elements:c,strategy:i}=t,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:a="floating",altBoundary:f=!1,padding:m=0}=e,p=xt(m),v=c[f?a==="floating"?"reference":"floating":a],g=F(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(v)))==null||n?v:v.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(c.floating)),boundary:u,rootBoundary:d,strategy:i})),h=F(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({rect:a==="floating"?{...s.floating,x:o,y:r}:s.reference,offsetParent:await(l.getOffsetParent==null?void 0:l.getOffsetParent(c.floating)),strategy:i}):s[a]);return{top:g.top-h.top+p.top,bottom:h.bottom-g.bottom+p.bottom,left:g.left-h.left+p.left,right:h.right-g.right+p.right}}var Zt=Math.min,R=Math.max;function nt(t,e,n){return R(t,Zt(e,n))}var rt=t=>({name:"arrow",options:t,async fn(e){let{element:n,padding:o=0}=t??{},{x:r,y:l,placement:s,rects:c,platform:i}=e;if(n==null)return{};let u=xt(o),d={x:r,y:l},a=B(s),f=ot(a),m=await i.getDimensions(n),p=a==="y"?"top":"left",w=a==="y"?"bottom":"right",v=c.reference[f]+c.reference[a]-d[a]-c.floating[f],g=d[a]-c.reference[a],h=await(i.getOffsetParent==null?void 0:i.getOffsetParent(n)),y=h?a==="y"?h.clientHeight||0:h.clientWidth||0:0,x=v/2-g/2,D=u[p],U=y-m[f]-u[w],I=y/2-m[f]/2+x,N=nt(D,I,U);return{data:{[a]:N,centerOffset:I-N}}}}),Gt={left:"right",right:"left",bottom:"top",top:"bottom"};function K(t){return t.replace(/left|right|bottom|top/g,e=>Gt[e])}function Qt(t,e,n){n===void 0&&(n=!1);let o=Y(t),r=B(t),l=ot(r),s=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[l]>e.floating[l]&&(s=K(s)),{main:s,cross:K(s)}}var te={start:"end",end:"start"};function yt(t){return t.replace(/start|end/g,e=>te[e])}function ee(t){let e=K(t);return[yt(t),e,yt(e)]}var it=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n;let{placement:o,middlewareData:r,rects:l,initialPlacement:s,platform:c,elements:i}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:a,fallbackStrategy:f="bestFit",flipAlignment:m=!0,...p}=t,w=H(o),g=a||(w===s||!m?[K(s)]:ee(s)),h=[s,...g],y=await X(e,p),x=[],D=((n=r.flip)==null?void 0:n.overflows)||[];if(u&&x.push(y[w]),d){let{main:z,cross:q}=Qt(o,l,await(c.isRTL==null?void 0:c.isRTL(i.floating)));x.push(y[z],y[q])}if(D=[...D,{placement:o,overflows:x}],!x.every(z=>z<=0)){var U,I;let z=((U=(I=r.flip)==null?void 0:I.index)!=null?U:0)+1,q=h[z];if(q)return{data:{index:z,overflows:D},reset:{placement:q}};let $="bottom";switch(f){case"bestFit":{var N;let wt=(N=D.slice().sort((_t,jt)=>_t.overflows.filter(S=>S>0).reduce((S,tt)=>S+tt,0)-jt.overflows.filter(S=>S>0).reduce((S,tt)=>S+tt,0))[0])==null?void 0:N.placement;wt&&($=wt);break}case"initialPlacement":$=s;break}if(o!==$)return{reset:{placement:$}}}return{}}}};function ne(t,e,n,o){o===void 0&&(o=!1);let r=H(t),l=Y(t),s=B(t)==="x",c=["left","top"].includes(r)?-1:1,i=o&&s?-1:1,u=typeof n=="function"?n({...e,placement:t}):n,d=typeof u=="number",{mainAxis:a,crossAxis:f,alignmentAxis:m}=d?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...u};return l&&typeof m=="number"&&(f=l==="end"?m*-1:m),s?{x:f*i,y:a*c}:{x:a*c,y:f*i}}var lt=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){let{x:n,y:o,placement:r,rects:l,platform:s,elements:c}=e,i=ne(r,l,t,await(s.isRTL==null?void 0:s.isRTL(c.floating)));return{x:n+i.x,y:o+i.y,data:i}}}};function oe(t){return t==="x"?"y":"x"}var st=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){let{x:n,y:o,placement:r}=e,{mainAxis:l=!0,crossAxis:s=!1,limiter:c={fn:v=>{let{x:g,y:h}=v;return{x:g,y:h}}},...i}=t,u={x:n,y:o},d=await X(e,i),a=B(H(r)),f=oe(a),m=u[a],p=u[f];if(l){let v=a==="y"?"top":"left",g=a==="y"?"bottom":"right",h=m+d[v],y=m-d[g];m=nt(h,m,y)}if(s){let v=f==="y"?"top":"left",g=f==="y"?"bottom":"right",h=p+d[v],y=p-d[g];p=nt(h,p,y)}let w=c.fn({...e,[a]:m,[f]:p});return{...w,data:{x:w.x-n,y:w.y-o}}}}};var at=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){let{placement:n,rects:o,platform:r,elements:l}=e,{apply:s,...c}=t,i=await X(e,c),u=H(n),d=Y(n),a,f;u==="top"||u==="bottom"?(a=u,f=d===(await(r.isRTL==null?void 0:r.isRTL(l.floating))?"start":"end")?"left":"right"):(f=u,a=d==="end"?"top":"bottom");let m=R(i.left,0),p=R(i.right,0),w=R(i.top,0),v=R(i.bottom,0),g={height:o.floating.height-(["left","right"].includes(n)?2*(w!==0||v!==0?w+v:R(i.top,i.bottom)):i[a]),width:o.floating.width-(["top","bottom"].includes(n)?2*(m!==0||p!==0?m+p:R(i.left,i.right)):i[f])},h=await r.getDimensions(l.floating);s?.({...g,...o});let y=await r.getDimensions(l.floating);return h.width!==y.width||h.height!==y.height?{reset:{rects:!0}}:{}}}};function Pt(t){return t&&t.document&&t.location&&t.alert&&t.setInterval}function L(t){if(t==null)return window;if(!Pt(t)){let e=t.ownerDocument;return e&&e.defaultView||window}return t}function j(t){return L(t).getComputedStyle(t)}function A(t){return Pt(t)?"":t?(t.nodeName||"").toLowerCase():""}function E(t){return t instanceof L(t).HTMLElement}function V(t){return t instanceof L(t).Element}function re(t){return t instanceof L(t).Node}function ut(t){let e=L(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function Z(t){let{overflow:e,overflowX:n,overflowY:o}=j(t);return/auto|scroll|overlay|hidden/.test(e+o+n)}function ie(t){return["table","td","th"].includes(A(t))}function St(t){let e=navigator.userAgent.toLowerCase().includes("firefox"),n=j(t);return n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].includes(n.willChange)||e&&n.willChange==="filter"||e&&(n.filter?n.filter!=="none":!1)}function Rt(){return!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}var Et=Math.min,_=Math.max,J=Math.round;function k(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);let o=t.getBoundingClientRect(),r=1,l=1;e&&E(t)&&(r=t.offsetWidth>0&&J(o.width)/t.offsetWidth||1,l=t.offsetHeight>0&&J(o.height)/t.offsetHeight||1);let s=V(t)?L(t):window,c=!Rt()&&n,i=(o.left+(c?s.visualViewport.offsetLeft:0))/r,u=(o.top+(c?s.visualViewport.offsetTop:0))/l,d=o.width/r,a=o.height/l;return{width:d,height:a,top:u,right:i+d,bottom:u+a,left:i,x:i,y:u}}function P(t){return((re(t)?t.ownerDocument:t.document)||window.document).documentElement}function G(t){return V(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function kt(t){return k(P(t)).left+G(t).scrollLeft}function le(t){let e=k(t);return J(e.width)!==t.offsetWidth||J(e.height)!==t.offsetHeight}function se(t,e,n){let o=E(e),r=P(e),l=k(t,o&&le(e),n==="fixed"),s={scrollLeft:0,scrollTop:0},c={x:0,y:0};if(o||!o&&n!=="fixed")if((A(e)!=="body"||Z(r))&&(s=G(e)),E(e)){let i=k(e,!0);c.x=i.x+e.clientLeft,c.y=i.y+e.clientTop}else r&&(c.x=kt(r));return{x:l.left+s.scrollLeft-c.x,y:l.top+s.scrollTop-c.y,width:l.width,height:l.height}}function ft(t){return A(t)==="html"?t:t.assignedSlot||t.parentNode||(ut(t)?t.host:null)||P(t)}function At(t){return!E(t)||getComputedStyle(t).position==="fixed"?null:t.offsetParent}function ae(t){let e=ft(t);for(ut(e)&&(e=e.host);E(e)&&!["html","body"].includes(A(e));){if(St(e))return e;e=e.parentNode}return null}function ct(t){let e=L(t),n=At(t);for(;n&&ie(n)&&getComputedStyle(n).position==="static";)n=At(n);return n&&(A(n)==="html"||A(n)==="body"&&getComputedStyle(n).position==="static"&&!St(n))?e:n||ae(t)||e}function Lt(t){if(E(t))return{width:t.offsetWidth,height:t.offsetHeight};let e=k(t);return{width:e.width,height:e.height}}function ce(t){let{rect:e,offsetParent:n,strategy:o}=t,r=E(n),l=P(n);if(n===l)return e;let s={scrollLeft:0,scrollTop:0},c={x:0,y:0};if((r||!r&&o!=="fixed")&&((A(n)!=="body"||Z(l))&&(s=G(n)),E(n))){let i=k(n,!0);c.x=i.x+n.clientLeft,c.y=i.y+n.clientTop}return{...e,x:e.x-s.scrollLeft+c.x,y:e.y-s.scrollTop+c.y}}function ue(t,e){let n=L(t),o=P(t),r=n.visualViewport,l=o.clientWidth,s=o.clientHeight,c=0,i=0;if(r){l=r.width,s=r.height;let u=Rt();(u||!u&&e==="fixed")&&(c=r.offsetLeft,i=r.offsetTop)}return{width:l,height:s,x:c,y:i}}function fe(t){var e;let n=P(t),o=G(t),r=(e=t.ownerDocument)==null?void 0:e.body,l=_(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),s=_(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),c=-o.scrollLeft+kt(t),i=-o.scrollTop;return j(r||n).direction==="rtl"&&(c+=_(n.clientWidth,r?r.clientWidth:0)-l),{width:l,height:s,x:c,y:i}}function Tt(t){let e=ft(t);return["html","body","#document"].includes(A(e))?t.ownerDocument.body:E(e)&&Z(e)?e:Tt(e)}function Q(t,e){var n;e===void 0&&(e=[]);let o=Tt(t),r=o===((n=t.ownerDocument)==null?void 0:n.body),l=L(o),s=r?[l].concat(l.visualViewport||[],Z(o)?o:[]):o,c=e.concat(s);return r?c:c.concat(Q(ft(s)))}function de(t,e){let n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&ut(n)){let o=e;do{if(o&&t===o)return!0;o=o.parentNode||o.host}while(o)}return!1}function me(t,e){let n=k(t,!1,e==="fixed"),o=n.top+t.clientTop,r=n.left+t.clientLeft;return{top:o,left:r,x:r,y:o,right:r+t.clientWidth,bottom:o+t.clientHeight,width:t.clientWidth,height:t.clientHeight}}function Ot(t,e,n){return e==="viewport"?F(ue(t,n)):V(e)?me(e,n):F(fe(P(t)))}function pe(t){let e=Q(t),o=["absolute","fixed"].includes(j(t).position)&&E(t)?ct(t):t;return V(o)?e.filter(r=>V(r)&&de(r,o)&&A(r)!=="body"):[]}function he(t){let{element:e,boundary:n,rootBoundary:o,strategy:r}=t,s=[...n==="clippingAncestors"?pe(e):[].concat(n),o],c=s[0],i=s.reduce((u,d)=>{let a=Ot(e,d,r);return u.top=_(a.top,u.top),u.right=Et(a.right,u.right),u.bottom=Et(a.bottom,u.bottom),u.left=_(a.left,u.left),u},Ot(e,c,r));return{width:i.right-i.left,height:i.bottom-i.top,x:i.left,y:i.top}}var ge={getClippingRect:he,convertOffsetParentRelativeRectToViewportRelativeRect:ce,isElement:V,getDimensions:Lt,getOffsetParent:ct,getDocumentElement:P,getElementRects:t=>{let{reference:e,floating:n,strategy:o}=t;return{reference:se(e,ct(n),o),floating:{...Lt(n),x:0,y:0}}},getClientRects:t=>Array.from(t.getClientRects()),isRTL:t=>j(t).direction==="rtl"};var Ct=(t,e,n)=>bt(t,e,{platform:ge,...n});var we=()=>{};var We=(()=>{let t=0;return()=>(t++,t.toString(36))})();var T=new Map,O=new Map;function ve(t,e,n,o){var r;if(!t)return we;let l=JSON.stringify({type:e,options:o}),s=T.get(t);if(T.has(t))s!=null&&s.has(l)?(r=s?.get(l))==null||r.add(n):s?.set(l,new Set([n]));else{let i=new Map([[l,new Set([n])]]);T.set(t,i)}function c(i){var u,d;function a(f){var m;let p=T.get(i);(m=p?.get(l))==null||m.forEach(w=>w(f))}if(!(O!=null&&O.has(i))){O.set(i,new Map([[l,a]])),i.addEventListener(e,a,o);return}(u=O?.get(i))!=null&&u.has(l)||((d=O.get(i))==null||d.set(l,a),i.addEventListener(e,a,o))}return c(t),function(){var i,u,d,a;if(!T.has(t))return;let f=T.get(t);if((i=f?.get(l))==null||i.delete(n),((u=f?.get(l))==null?void 0:u.size)===0){let m=(d=O.get(t))==null?void 0:d.get(l);t.removeEventListener(e,m,o),f?.delete(l),(a=O.get(t))==null||a.delete(l),f?.size===0&&(T.delete(t),O.delete(t))}}}var Mt=t=>Object.prototype.toString.call(t).slice(8,-1),ye=t=>Mt(t)==="Object"&&"current"in t,be=t=>Mt(t)==="Function"?t():t;function mt(t,e,n,o){let r=ye(t)?t.current:be(t);return ve(r,e,n,o)}function Dt(t){var e;return xe(t)?t.document:(e=t?.ownerDocument)!=null?e:document}function pt(t){return typeof t=="object"&&t?.nodeType===Node.ELEMENT_NODE&&typeof t?.nodeName=="string"}function xe(t){return t?.toString()==="[object Window]"}var Ie=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","embed","iframe","object","a[href]","area[href]","[tabindex]","audio[controls]","video[controls]","*[tabindex]:not([aria-disabled])","[contenteditable]:not([contenteditable=false])","details > summary:first-of-type"].join(",");var C=new Map;function ht(t,e){let n=C.get(t);return n?(n.callbacks.push(e),e(t.getBoundingClientRect())):(C.set(t,{rect:{},callbacks:[e]}),C.size===1&&(dt=requestAnimationFrame(zt))),function(){let o=C.get(t);if(!o)return;let r=o.callbacks.indexOf(e);r>-1&&o.callbacks.splice(r,1),o.callbacks.length===0&&(C.delete(t),C.size===0&&cancelAnimationFrame(dt))}}var dt;function zt(){let t=[];C.forEach((e,n)=>{let o=n.getBoundingClientRect();Ee(e.rect,o)||(e.rect=o,t.push(e))}),t.forEach(e=>{e.callbacks.forEach(n=>n(e.rect))}),dt=requestAnimationFrame(zt)}function Ee(t,e){return t.width===e.width&&t.height===e.height&&t.top===e.top&&t.right===e.right&&t.bottom===e.bottom&&t.left===e.left}var gt=()=>{},W=(...t)=>e=>t.reduce((n,o)=>o(n),e);var Fe=(()=>{let t=0;return()=>(t++,t.toString(36))})();var Ht=t=>t===!0||t===!1;function Ae(t){return Ht(t)?{ancestorResize:t,ancestorScroll:t,referenceResize:t}:Object.assign({ancestorResize:!0,ancestorScroll:!0,referenceResize:!0},t)}function Vt(t,e,n,o=!1){let{ancestorScroll:r,ancestorResize:l,referenceResize:s}=Ae(o),c=r||l,i=[];c&&pt(t)&&i.push(...Q(t));function u(){let a=[ht(e,n)];return s&&pt(t)&&a.push(ht(t,n)),a.push(W(...i.map(f=>mt(f,"resize",n)))),()=>a.forEach(f=>f())}function d(){return W(...i.map(a=>mt(a,"scroll",n,{passive:!0})))}return W(u(),d())}var M=t=>({variable:t,reference:`var(${t})`}),b={arrowShadowColor:M("--arrow-shadow-color"),arrowSize:M("--arrow-size"),arrowSizeHalf:M("--arrow-size-half"),arrowBg:M("--arrow-background"),transformOrigin:M("--transform-origin"),arrowOffset:M("--arrow-offset"),boxShadow:M("--arrow-box-shadow")},Wt={top:"bottom center","top-start":"bottom left","top-end":"bottom right",bottom:"top center","bottom-start":"top left","bottom-end":"top right",left:"right center","left-start":"right top","left-end":"right bottom",right:"left center","right-start":"left top","right-end":"left bottom"},It={name:"transformOrigin",fn({placement:t,elements:e}){let{floating:n}=e;return n.style.setProperty(b.transformOrigin.variable,Wt[t]),{data:{transformOrigin:Wt[t]}}}},Nt=t=>({name:"shiftArrow",fn({placement:e,middlewareData:n}){var c;let{element:o}=t,{x:r,y:l}=(c=n.arrow)!=null?c:{x:0,y:0},s={top:"bottom",right:"left",bottom:"top",left:"right"}[e.split("-")[0]];return Object.assign(o.style,{top:`${l}px`,left:`${r}px`,[s]:b.arrowOffset.reference,[b.boxShadow.variable]:Le(e)}),{}}});function Le(t){if(t.includes("top"))return`1px 1px 1px 0 ${b.arrowShadowColor.reference}`;if(t.includes("bottom"))return`-1px -1px 1px 0 ${b.arrowShadowColor.reference}`;if(t.includes("right"))return`-1px 1px 1px 0 ${b.arrowShadowColor.reference}`;if(t.includes("left"))return`1px -1px 1px 0 ${b.arrowShadowColor.reference}`}var Oe={strategy:"absolute",placement:"bottom",listeners:!0,gutter:8,flip:!0,sameWidth:!1};function Ft(t,e,n={}){var c;if(t==null||e==null)return gt;n=Object.assign({},Oe,n);let o=[It];if(n.flip&&o.push(it({boundary:n.boundary,padding:8})),n.gutter||n.offset){let i=n.gutter?{mainAxis:n.gutter}:n.offset;o.push(lt(i))}o.push(st({boundary:n.boundary}));let l=Dt(e).querySelector("[data-part=arrow]");l&&o.push(rt({element:l,padding:8}),Nt({element:l})),n.sameWidth&&o.push(at({apply(i){let{width:u}=i.reference;Object.assign(e.style,{width:`${u}px`,minWidth:"unset"})}}));function s(){if(t==null||e==null)return;let{placement:i,strategy:u}=n;Ct(t,e,{placement:i,middleware:o,strategy:u}).then(d=>{let{x:a,y:f,strategy:m}=d;return Object.assign(e.style,{left:`${a}px`,top:`${f}px`,position:m}),d}).then(d=>{var a;(a=n.onComplete)==null||a.call(n,d)})}return s(),W(Vt(t,e,s,n.listeners),(c=n.onCleanup)!=null?c:gt)}var Pe={position:"fixed",top:0,left:0,opacity:0,transform:"translate3d(0, -200%, 0)",pointerEvents:"none"};function Bt(t){let{measured:e,strategy:n="absolute"}=t;return{arrow:{position:"absolute",width:b.arrowSize.reference,height:b.arrowSize.reference,[b.arrowSizeHalf.variable]:`calc(${b.arrowSize.reference} / 2)`,[b.arrowOffset.variable]:`calc(${b.arrowSizeHalf.reference} * -1)`,opacity:e?void 0:0},innerArrow:{transform:"rotate(45deg)",background:b.arrowBg.reference,top:"0",left:"0",width:"100%",height:"100%",position:"absolute",zIndex:"inherit"},floating:{position:n,minWidth:"max-content",...!e&&Pe}}}
//# sourceMappingURL=index.js.map
{
"name": "@zag-js/popper",
"version": "0.0.0-dev-20220412162814",
"version": "0.0.0-dev-20220412212252",
"description": "Dynamic positioning logic for ui machines",

@@ -11,3 +11,3 @@ "keywords": [

"author": "Segun Adebayo <sage@adebayosegun.com>",
"homepage": "https://github.com/chakra-ui/ui-machines#readme",
"homepage": "https://github.com/chakra-ui/zag#readme",
"license": "MIT",

@@ -17,3 +17,3 @@ "main": "dist/index.js",

"types": "dist/index.d.ts",
"repository": "https://github.com/chakra-ui/ui-machines/tree/main/packages/utilities/popper",
"repository": "https://github.com/chakra-ui/zag/tree/main/packages/utilities/popper",
"sideEffects": false,

@@ -27,9 +27,9 @@ "files": [

"bugs": {
"url": "https://github.com/chakra-ui/ui-machines/issues"
"url": "https://github.com/chakra-ui/zag/issues"
},
"dependencies": {
"@floating-ui/dom": "^0.4.2",
"@zag-js/dom-utils": "^0.0.0-dev-20220412162814",
"@zag-js/utils": "^0.0.0-dev-20220412162814"
"@zag-js/dom-utils": "^0.0.0-dev-20220412212252",
"@zag-js/utils": "^0.0.0-dev-20220412212252"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc