Socket
Socket
Sign inDemoInstall

@radix-ui/popper

Package Overview
Dependencies
Maintainers
5
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@radix-ui/popper - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

2

dist/index.js

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

function t(t,e,r){Object.defineProperty(t,e,{get:r,enumerable:!0})}var e={};const r=["top","right","bottom","left"];exports.SIDE_OPTIONS=r;const o=["start","center","end"];function n({anchorRect:t,popperSize:e,arrowSize:r,arrowOffset:o=0,side:n,sideOffset:l=0,align:x,alignOffset:u=0,shouldAvoidCollisions:g=!0,collisionBoundariesRect:m,collisionTolerance:w=0}){if(!t||!e||!m)return{popperStyles:s,arrowStyles:c};const y=function(t,e,r=0,o=0,n){const p=n?n.height:0,a=i(e,t,"x"),s=i(e,t,"y"),c=s.before-r-p,f=s.after+r+p,l=a.before-r-p,d=a.after+r+p;return{top:{start:{x:a.start+o,y:c},center:{x:a.center,y:c},end:{x:a.end-o,y:c}},right:{start:{x:d,y:s.start+o},center:{x:d,y:s.center},end:{x:d,y:s.end-o}},bottom:{start:{x:a.start+o,y:f},center:{x:a.center,y:f},end:{x:a.end-o,y:f}},left:{start:{x:l,y:s.start+o},center:{x:l,y:s.center},end:{x:l,y:s.end-o}}}}(e,t,l,u,r),b=y[n][x];if(!1===g){const t=p(b);let i=c;r&&(i=f({popperSize:e,arrowSize:r,arrowOffset:o,side:n,align:x}));return{popperStyles:{...t,"--radix-popper-transform-origin":a(e,n,x,o,r)},arrowStyles:i,placedSide:n,placedAlign:x}}const S=DOMRect.fromRect({...e,...b}),O=($=m,z=w,DOMRect.fromRect({width:$.width-2*z,height:$.height-2*z,x:$.left+z,y:$.top+z}));var $,z;const I=h(S,O),R=y[d(n)][x],D=function(t,e,r){const o=d(t);return e[t]&&!r[o]?o:t}(n,I,h(DOMRect.fromRect({...e,...R}),O)),P=function(t,e,r,o,n){const i="top"===r||"bottom"===r,p=i?"left":"top",a=i?"right":"bottom",s=i?"width":"height",c=e[s]>t[s];if(("start"===o||"center"===o)&&(n[p]&&c||n[a]&&!c))return"end";if(("end"===o||"center"===o)&&(n[a]&&c||n[p]&&!c))return"start";return o}(e,t,n,x,I),M=p(y[D][P]);let N=c;r&&(N=f({popperSize:e,arrowSize:r,arrowOffset:o,side:D,align:P}));return{popperStyles:{...M,"--radix-popper-transform-origin":a(e,D,P,o,r)},arrowStyles:N,placedSide:D,placedAlign:P}}function i(t,e,r){const o=t["x"===r?"left":"top"],n="x"===r?"width":"height",i=t[n],p=e[n];return{before:o-p,start:o,center:o+(i-p)/2,end:o+i-p,after:o+i}}function p(t){return{position:"absolute",top:0,left:0,minWidth:"max-content",willChange:"transform",transform:`translate3d(${Math.round(t.x+window.scrollX)}px, ${Math.round(t.y+window.scrollY)}px, 0)`}}function a(t,e,r,o,n){const i="top"===e||"bottom"===e,p=n?n.width:0,a=n?n.height:0,s=p/2+o;let c="",f="";return i?(c={start:`${s}px`,center:"center",end:t.width-s+"px"}[r],f="top"===e?`${t.height+a}px`:-a+"px"):(c="left"===e?`${t.width+a}px`:-a+"px",f={start:`${s}px`,center:"center",end:t.height-s+"px"}[r]),`${c} ${f}`}exports.ALIGN_OPTIONS=o,exports.getPlacementData=n;const s={position:"fixed",top:0,left:0,opacity:0,transform:"translate3d(0, -200%, 0)"},c={position:"absolute",opacity:0};function f({popperSize:t,arrowSize:e,arrowOffset:r,side:o,align:n}){const i=(t.width-e.width)/2,p=(t.height-e.width)/2,a={top:0,right:90,bottom:180,left:-90}[o],s=Math.max(e.width,e.height),c={width:`${s}px`,height:`${s}px`,transform:`rotate(${a}deg)`,willChange:"transform",position:"absolute",[o]:"100%",direction:l(o,n)};return"top"!==o&&"bottom"!==o||("start"===n&&(c.left=`${r}px`),"center"===n&&(c.left=`${i}px`),"end"===n&&(c.right=`${r}px`)),"left"!==o&&"right"!==o||("start"===n&&(c.top=`${r}px`),"center"===n&&(c.top=`${p}px`),"end"===n&&(c.bottom=`${r}px`)),c}function l(t,e){return("top"!==t&&"right"!==t||"end"!==e)&&("bottom"!==t&&"left"!==t||"end"===e)?"ltr":"rtl"}function d(t){return{top:"bottom",right:"left",bottom:"top",left:"right"}[t]}function h(t,e){return{top:t.top<e.top,right:t.right>e.right,bottom:t.bottom>e.bottom,left:t.left<e.left}}t(e,"ALIGN_OPTIONS",(function(){return o})),t(e,"SIDE_OPTIONS",(function(){return r})),t(e,"getPlacementData",(function(){return n}));
exports.SIDE_OPTIONS=["top","right","bottom","left"];function t(t,e,r){const o=t["x"===r?"left":"top"],n="x"===r?"width":"height",i=t[n],p=e[n];return{before:o-p,start:o,center:o+(i-p)/2,end:o+i-p,after:o+i}}function e(t){return{position:"absolute",top:0,left:0,minWidth:"max-content",willChange:"transform",transform:`translate3d(${Math.round(t.x+window.scrollX)}px, ${Math.round(t.y+window.scrollY)}px, 0)`}}function r(t,e,r,o,n){const i="top"===e||"bottom"===e,p=n?n.width:0,a=n?n.height:0,s=p/2+o;let c="",f="";return i?(c={start:`${s}px`,center:"center",end:t.width-s+"px"}[r],f="top"===e?`${t.height+a}px`:-a+"px"):(c="left"===e?`${t.width+a}px`:-a+"px",f={start:`${s}px`,center:"center",end:t.height-s+"px"}[r]),`${c} ${f}`}exports.ALIGN_OPTIONS=["start","center","end"],exports.getPlacementData=function({anchorRect:p,popperSize:c,arrowSize:f,arrowOffset:l=0,side:d,sideOffset:h=0,align:x,alignOffset:g=0,shouldAvoidCollisions:u=!0,collisionBoundariesRect:w,collisionTolerance:m=0}){if(!p||!c||!w)return{popperStyles:o,arrowStyles:n};const y=function(e,r,o=0,n=0,i){const p=i?i.height:0,a=t(r,e,"x"),s=t(r,e,"y"),c=s.before-o-p,f=s.after+o+p,l=a.before-o-p,d=a.after+o+p;return{top:{start:{x:a.start+n,y:c},center:{x:a.center,y:c},end:{x:a.end-n,y:c}},right:{start:{x:d,y:s.start+n},center:{x:d,y:s.center},end:{x:d,y:s.end-n}},bottom:{start:{x:a.start+n,y:f},center:{x:a.center,y:f},end:{x:a.end-n,y:f}},left:{start:{x:l,y:s.start+n},center:{x:l,y:s.center},end:{x:l,y:s.end-n}}}}(c,p,h,g,f),b=y[d][x];if(!1===u){const t=e(b);let o=n;f&&(o=i({popperSize:c,arrowSize:f,arrowOffset:l,side:d,align:x}));return{popperStyles:{...t,"--radix-popper-transform-origin":r(c,d,x,l,f)},arrowStyles:o,placedSide:d,placedAlign:x}}const S=DOMRect.fromRect({...c,...b}),$=(O=w,z=m,DOMRect.fromRect({width:O.width-2*z,height:O.height-2*z,x:O.left+z,y:O.top+z}));var O,z;const R=s(S,$),M=y[a(d)][x],D=function(t,e,r){const o=a(t);return e[t]&&!r[o]?o:t}(d,R,s(DOMRect.fromRect({...c,...M}),$)),A=function(t,e,r,o,n){const i="top"===r||"bottom"===r,p=i?"left":"top",a=i?"right":"bottom",s=i?"width":"height",c=e[s]>t[s];if(("start"===o||"center"===o)&&(n[p]&&c||n[a]&&!c))return"end";if(("end"===o||"center"===o)&&(n[a]&&c||n[p]&&!c))return"start";return o}(c,p,d,x,R),I=e(y[D][A]);let C=n;return f&&(C=i({popperSize:c,arrowSize:f,arrowOffset:l,side:D,align:A})),{popperStyles:{...I,"--radix-popper-transform-origin":r(c,D,A,l,f)},arrowStyles:C,placedSide:D,placedAlign:A}};const o={position:"fixed",top:0,left:0,opacity:0,transform:"translate3d(0, -200%, 0)"},n={position:"absolute",opacity:0};function i({popperSize:t,arrowSize:e,arrowOffset:r,side:o,align:n}){const i=(t.width-e.width)/2,a=(t.height-e.width)/2,s={top:0,right:90,bottom:180,left:-90}[o],c=Math.max(e.width,e.height),f={width:`${c}px`,height:`${c}px`,transform:`rotate(${s}deg)`,willChange:"transform",position:"absolute",[o]:"100%",direction:p(o,n)};return"top"!==o&&"bottom"!==o||("start"===n&&(f.left=`${r}px`),"center"===n&&(f.left=`${i}px`),"end"===n&&(f.right=`${r}px`)),"left"!==o&&"right"!==o||("start"===n&&(f.top=`${r}px`),"center"===n&&(f.top=`${a}px`),"end"===n&&(f.bottom=`${r}px`)),f}function p(t,e){return("top"!==t&&"right"!==t||"end"!==e)&&("bottom"!==t&&"left"!==t||"end"===e)?"ltr":"rtl"}function a(t){return{top:"bottom",right:"left",bottom:"top",left:"right"}[t]}function s(t,e){return{top:t.top<e.top,right:t.right>e.right,bottom:t.bottom>e.bottom,left:t.left<e.left}}
//# sourceMappingURL=index.js.map

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

function t(t,e,r){Object.defineProperty(t,e,{get:r,enumerable:!0})}var e={};export const SIDE_OPTIONS=["top","right","bottom","left"];export const ALIGN_OPTIONS=["start","center","end"];function r({anchorRect:t,popperSize:e,arrowSize:r,arrowOffset:s=0,side:d,sideOffset:h=0,align:x,alignOffset:u=0,shouldAvoidCollisions:g=!0,collisionBoundariesRect:m,collisionTolerance:w=0}){if(!t||!e||!m)return{popperStyles:p,arrowStyles:a};const S=function(t,e,r=0,n=0,i){const p=i?i.height:0,a=o(e,t,"x"),c=o(e,t,"y"),s=c.before-r-p,f=c.after+r+p,l=a.before-r-p,d=a.after+r+p;return{top:{start:{x:a.start+n,y:s},center:{x:a.center,y:s},end:{x:a.end-n,y:s}},right:{start:{x:d,y:c.start+n},center:{x:d,y:c.center},end:{x:d,y:c.end-n}},bottom:{start:{x:a.start+n,y:f},center:{x:a.center,y:f},end:{x:a.end-n,y:f}},left:{start:{x:l,y:c.start+n},center:{x:l,y:c.center},end:{x:l,y:c.end-n}}}}(e,t,h,u,r),y=S[d][x];if(!1===g){const t=n(y);let o=a;r&&(o=c({popperSize:e,arrowSize:r,arrowOffset:s,side:d,align:x}));return{popperStyles:{...t,"--radix-popper-transform-origin":i(e,d,x,s,r)},arrowStyles:o,placedSide:d,placedAlign:x}}const b=DOMRect.fromRect({...e,...y}),O=($=m,I=w,DOMRect.fromRect({width:$.width-2*I,height:$.height-2*I,x:$.left+I,y:$.top+I}));var $,I;const N=l(b,O),z=S[f(d)][x],P=function(t,e,r){const o=f(t);return e[t]&&!r[o]?o:t}(d,N,l(DOMRect.fromRect({...e,...z}),O)),R=function(t,e,r,o,n){const i="top"===r||"bottom"===r,p=i?"left":"top",a=i?"right":"bottom",c=i?"width":"height",s=e[c]>t[c];if(("start"===o||"center"===o)&&(n[p]&&s||n[a]&&!s))return"end";if(("end"===o||"center"===o)&&(n[a]&&s||n[p]&&!s))return"start";return o}(e,t,d,x,N),D=n(S[P][R]);let T=a;r&&(T=c({popperSize:e,arrowSize:r,arrowOffset:s,side:P,align:R}));return{popperStyles:{...D,"--radix-popper-transform-origin":i(e,P,R,s,r)},arrowStyles:T,placedSide:P,placedAlign:R}}export{r as getPlacementData};function o(t,e,r){const o=t["x"===r?"left":"top"],n="x"===r?"width":"height",i=t[n],p=e[n];return{before:o-p,start:o,center:o+(i-p)/2,end:o+i-p,after:o+i}}function n(t){return{position:"absolute",top:0,left:0,minWidth:"max-content",willChange:"transform",transform:`translate3d(${Math.round(t.x+window.scrollX)}px, ${Math.round(t.y+window.scrollY)}px, 0)`}}function i(t,e,r,o,n){const i="top"===e||"bottom"===e,p=n?n.width:0,a=n?n.height:0,c=p/2+o;let s="",f="";return i?(s={start:`${c}px`,center:"center",end:t.width-c+"px"}[r],f="top"===e?`${t.height+a}px`:-a+"px"):(s="left"===e?`${t.width+a}px`:-a+"px",f={start:`${c}px`,center:"center",end:t.height-c+"px"}[r]),`${s} ${f}`}const p={position:"fixed",top:0,left:0,opacity:0,transform:"translate3d(0, -200%, 0)"},a={position:"absolute",opacity:0};function c({popperSize:t,arrowSize:e,arrowOffset:r,side:o,align:n}){const i=(t.width-e.width)/2,p=(t.height-e.width)/2,a={top:0,right:90,bottom:180,left:-90}[o],c=Math.max(e.width,e.height),f={width:`${c}px`,height:`${c}px`,transform:`rotate(${a}deg)`,willChange:"transform",position:"absolute",[o]:"100%",direction:s(o,n)};return"top"!==o&&"bottom"!==o||("start"===n&&(f.left=`${r}px`),"center"===n&&(f.left=`${i}px`),"end"===n&&(f.right=`${r}px`)),"left"!==o&&"right"!==o||("start"===n&&(f.top=`${r}px`),"center"===n&&(f.top=`${p}px`),"end"===n&&(f.bottom=`${r}px`)),f}function s(t,e){return("top"!==t&&"right"!==t||"end"!==e)&&("bottom"!==t&&"left"!==t||"end"===e)?"ltr":"rtl"}function f(t){return{top:"bottom",right:"left",bottom:"top",left:"right"}[t]}function l(t,e){return{top:t.top<e.top,right:t.right>e.right,bottom:t.bottom>e.bottom,left:t.left<e.left}}t(e,"ALIGN_OPTIONS",(function(){return ALIGN_OPTIONS})),t(e,"SIDE_OPTIONS",(function(){return SIDE_OPTIONS})),t(e,"getPlacementData",(function(){return r}));
export const SIDE_OPTIONS=["top","right","bottom","left"];export const ALIGN_OPTIONS=["start","center","end"];export function getPlacementData({anchorRect:p,popperSize:c,arrowSize:f,arrowOffset:l=0,side:d,sideOffset:h=0,align:x,alignOffset:g=0,shouldAvoidCollisions:u=!0,collisionBoundariesRect:w,collisionTolerance:m=0}){if(!p||!c||!w)return{popperStyles:o,arrowStyles:n};const y=function(e,r,o=0,n=0,i){const p=i?i.height:0,a=t(r,e,"x"),s=t(r,e,"y"),c=s.before-o-p,f=s.after+o+p,l=a.before-o-p,d=a.after+o+p;return{top:{start:{x:a.start+n,y:c},center:{x:a.center,y:c},end:{x:a.end-n,y:c}},right:{start:{x:d,y:s.start+n},center:{x:d,y:s.center},end:{x:d,y:s.end-n}},bottom:{start:{x:a.start+n,y:f},center:{x:a.center,y:f},end:{x:a.end-n,y:f}},left:{start:{x:l,y:s.start+n},center:{x:l,y:s.center},end:{x:l,y:s.end-n}}}}(c,p,h,g,f),b=y[d][x];if(!1===u){const t=e(b);let o=n;f&&(o=i({popperSize:c,arrowSize:f,arrowOffset:l,side:d,align:x}));return{popperStyles:{...t,"--radix-popper-transform-origin":r(c,d,x,l,f)},arrowStyles:o,placedSide:d,placedAlign:x}}const S=DOMRect.fromRect({...c,...b}),$=(O=w,z=m,DOMRect.fromRect({width:O.width-2*z,height:O.height-2*z,x:O.left+z,y:O.top+z}));var O,z;const R=s(S,$),M=y[a(d)][x],D=function(t,e,r){const o=a(t);return e[t]&&!r[o]?o:t}(d,R,s(DOMRect.fromRect({...c,...M}),$)),A=function(t,e,r,o,n){const i="top"===r||"bottom"===r,p=i?"left":"top",a=i?"right":"bottom",s=i?"width":"height",c=e[s]>t[s];if(("start"===o||"center"===o)&&(n[p]&&c||n[a]&&!c))return"end";if(("end"===o||"center"===o)&&(n[a]&&c||n[p]&&!c))return"start";return o}(c,p,d,x,R),I=e(y[D][A]);let C=n;f&&(C=i({popperSize:c,arrowSize:f,arrowOffset:l,side:D,align:A}));return{popperStyles:{...I,"--radix-popper-transform-origin":r(c,D,A,l,f)},arrowStyles:C,placedSide:D,placedAlign:A}}function t(t,e,r){const o=t["x"===r?"left":"top"],n="x"===r?"width":"height",i=t[n],p=e[n];return{before:o-p,start:o,center:o+(i-p)/2,end:o+i-p,after:o+i}}function e(t){return{position:"absolute",top:0,left:0,minWidth:"max-content",willChange:"transform",transform:`translate3d(${Math.round(t.x+window.scrollX)}px, ${Math.round(t.y+window.scrollY)}px, 0)`}}function r(t,e,r,o,n){const i="top"===e||"bottom"===e,p=n?n.width:0,a=n?n.height:0,s=p/2+o;let c="",f="";return i?(c={start:`${s}px`,center:"center",end:t.width-s+"px"}[r],f="top"===e?`${t.height+a}px`:-a+"px"):(c="left"===e?`${t.width+a}px`:-a+"px",f={start:`${s}px`,center:"center",end:t.height-s+"px"}[r]),`${c} ${f}`}const o={position:"fixed",top:0,left:0,opacity:0,transform:"translate3d(0, -200%, 0)"},n={position:"absolute",opacity:0};function i({popperSize:t,arrowSize:e,arrowOffset:r,side:o,align:n}){const i=(t.width-e.width)/2,a=(t.height-e.width)/2,s={top:0,right:90,bottom:180,left:-90}[o],c=Math.max(e.width,e.height),f={width:`${c}px`,height:`${c}px`,transform:`rotate(${s}deg)`,willChange:"transform",position:"absolute",[o]:"100%",direction:p(o,n)};return"top"!==o&&"bottom"!==o||("start"===n&&(f.left=`${r}px`),"center"===n&&(f.left=`${i}px`),"end"===n&&(f.right=`${r}px`)),"left"!==o&&"right"!==o||("start"===n&&(f.top=`${r}px`),"center"===n&&(f.top=`${a}px`),"end"===n&&(f.bottom=`${r}px`)),f}function p(t,e){return("top"!==t&&"right"!==t||"end"!==e)&&("bottom"!==t&&"left"!==t||"end"===e)?"ltr":"rtl"}function a(t){return{top:"bottom",right:"left",bottom:"top",left:"right"}[t]}function s(t,e){return{top:t.top<e.top,right:t.right>e.right,bottom:t.bottom>e.bottom,left:t.left<e.left}}
//# sourceMappingURL=index.module.js.map
{
"name": "@radix-ui/popper",
"version": "0.0.8",
"version": "0.0.9",
"license": "MIT",

@@ -5,0 +5,0 @@ "source": "src/index.ts",

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