Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@floating-ui/dom

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@floating-ui/dom - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

2

dist/floating-ui.dom.js
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@floating-ui/core')) :
typeof define === 'function' && define.amd ? define(['exports', '@floating-ui/core'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.FloatingUI = {}, global.FloatingUICore));
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.FloatingUIDOM = {}, global.FloatingUICore));
})(this, (function (exports, core) { 'use strict';

@@ -6,0 +6,0 @@

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@floating-ui/core")):"function"==typeof define&&define.amd?define(["exports","@floating-ui/core"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).FloatingUI={},t.FloatingUICore)}(this,(function(t,e){"use strict";function n(t){const e=t.getBoundingClientRect();return{width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left,x:e.left,y:e.top}}function o(t){return"[object Window]"===(null==t?void 0:t.toString())}function i(t){if(null==t)return window;if(!o(t)){const e=t.ownerDocument;return e&&e.defaultView||window}return t}function r(t){return o(t)?"":t?(t.nodeName||"").toLowerCase():""}function l(t){return t instanceof i(t).HTMLElement}function c(t){return t instanceof i(t).Element}function f(t){return t instanceof i(t).ShadowRoot||t instanceof ShadowRoot}function u(t){const{overflow:e,overflowX:n,overflowY:o}=getComputedStyle(t);return/auto|scroll|overlay|hidden/.test(e+o+n)}function s(t){return["table","td","th"].includes(r(t))}function d(t){return(e=t,(e instanceof i(e).Node?t.ownerDocument:t.document)||window.document).documentElement;var e}function a(t){return o(t)?{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}:{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function h(t){return n(d(t)).left+a(t).scrollLeft}function m(t,e,o){const i=l(e),c=d(e),f=n(t);let s={scrollLeft:0,scrollTop:0},m={x:0,y:0};return(i||!i&&"fixed"!==o)&&(("body"!==r(e)||u(c))&&(s=a(e)),l(e)?(m=n(e),m.x+=e.clientLeft,m.y+=e.clientTop):c&&(m.x=h(c))),{x:f.left+s.scrollLeft-m.x,y:f.top+s.scrollTop-m.y,width:f.width,height:f.height}}function p(t){return"html"===r(t)?t:t.assignedSlot||t.parentNode||(f(t)?t.host:null)||d(t)}function g(t){return l(t)&&"fixed"!==getComputedStyle(t).position?t.offsetParent:null}function y(t){const e=i(t);let n=g(t);for(;n&&s(n)&&"static"===getComputedStyle(n).position;)n=g(n);return n&&("html"===r(n)||"body"===r(n)&&"static"===getComputedStyle(n).position)?e:n||function(t){const e=navigator.userAgent.toLowerCase().includes("firefox");let n=p(t);for(;l(n)&&!["html","body"].includes(r(n));){const t=getComputedStyle(n);if("none"!==t.transform||"none"!==t.perspective||"paint"===t.contain||["transform","perspective"].includes(t.willChange)||e&&"filter"===t.willChange||e&&t.filter&&"none"!==t.filter)return n;n=n.parentNode}return null}(t)||e}function b(t){return{width:t.offsetWidth,height:t.offsetHeight}}function w(t){return i(t).getComputedStyle(t)}function v(t){return["html","body","#document"].includes(r(t))?t.ownerDocument.body:l(t)&&u(t)?t:v(p(t))}function x(t){var e;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const o=v(t),r=o===(null===(e=t.ownerDocument)||void 0===e?void 0:e.body),l=i(o),c=r?[l].concat(l.visualViewport||[],u(o)?o:[]):o,f=n.concat(c);return r?f:f.concat(x(p(c)))}function P(t,o){return"viewport"===o?e.rectToClientRect(function(t){const e=i(t),n=d(t),o=e.visualViewport;let r=n.clientWidth,l=n.clientHeight,c=0,f=0;return o&&(r=o.width,l=o.height,Math.abs(e.innerWidth/o.scale-o.width)<.001&&(c=o.offsetLeft,f=o.offsetTop)),{width:r,height:l,x:c,y:f}}(t)):c(o)?function(t){const e=n(t),o=e.top+t.clientTop,i=e.left+t.clientLeft;return{top:o,left:i,x:i,y:o,right:i+t.clientWidth,bottom:o+t.clientHeight,width:t.clientWidth,height:t.clientHeight}}(o):e.rectToClientRect(function(t){var e;const n=d(t),o=a(t),i=null===(e=t.ownerDocument)||void 0===e?void 0:e.body,r=Math.max(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),l=Math.max(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0);let c=-o.scrollLeft+h(t);const f=-o.scrollTop;return"rtl"===w(i||n).direction&&(c+=Math.max(n.clientWidth,i?i.clientWidth:0)-r),{width:r,height:l,x:c,y:f}}(d(t)))}function T(t){const e=x(p(t)),n=["absolute","fixed"].includes(w(t).position),o=n&&l(t)?y(t):t;return c(o)?e.filter((t=>c(t)&&function(t,e){var n;const o=null===(n=e.getRootNode)||void 0===n?void 0:n.call(e);if(t.contains(e))return!0;if(o&&f(o)){let n=e;do{if(n&&t.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}(t,o)&&"body"!==r(t)&&(!n||"static"!==w(t).position))):[]}const C={getElementRects:t=>{let{reference:e,floating:n,strategy:o}=t;return Promise.resolve({reference:m(e,y(n),o),floating:{...b(n),x:0,y:0}})},convertOffsetParentRelativeRectToViewportRelativeRect:t=>Promise.resolve(function(t){let{rect:e,offsetParent:o,strategy:i}=t;const c=l(o),f=d(o);if(o===f)return e;let s={scrollLeft:0,scrollTop:0},h={x:0,y:0};return(c||!c&&"fixed"!==i)&&(("body"!==r(o)||u(f))&&(s=a(o)),l(o)&&(h=n(o),h.x+=o.clientLeft,h.y+=o.clientTop)),{...e,x:e.x-s.scrollLeft+h.x,y:e.y-s.scrollTop+h.y}}(t)),getOffsetParent:t=>{let{element:e}=t;return Promise.resolve(y(e))},isElement:t=>Promise.resolve(c(t)),getDocumentElement:t=>{let{element:e}=t;return Promise.resolve(d(e))},getClippingClientRect:t=>Promise.resolve(function(t){let{element:e,boundary:n,rootBoundary:o}=t;const i=[..."clippingParents"===n?T(e):[].concat(n),o],r=i[0],l=i.reduce(((t,n)=>{const o=P(e,n);return t.top=Math.max(o.top,t.top),t.right=Math.min(o.right,t.right),t.bottom=Math.min(o.bottom,t.bottom),t.left=Math.max(o.left,t.left),t}),P(e,r));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}(t)),getDimensions:t=>{let{element:e}=t;return Promise.resolve(b(e))}};Object.defineProperty(t,"arrow",{enumerable:!0,get:function(){return e.arrow}}),Object.defineProperty(t,"autoPlacement",{enumerable:!0,get:function(){return e.autoPlacement}}),Object.defineProperty(t,"detectOverflow",{enumerable:!0,get:function(){return e.detectOverflow}}),Object.defineProperty(t,"flip",{enumerable:!0,get:function(){return e.flip}}),Object.defineProperty(t,"hide",{enumerable:!0,get:function(){return e.hide}}),Object.defineProperty(t,"limitShift",{enumerable:!0,get:function(){return e.limitShift}}),Object.defineProperty(t,"offset",{enumerable:!0,get:function(){return e.offset}}),Object.defineProperty(t,"shift",{enumerable:!0,get:function(){return e.shift}}),Object.defineProperty(t,"size",{enumerable:!0,get:function(){return e.size}}),t.computePosition=(t,n,o)=>e.computePosition(t,n,{platform:C,...o}),t.getScrollParents=x,Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@floating-ui/core")):"function"==typeof define&&define.amd?define(["exports","@floating-ui/core"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).FloatingUIDOM={},t.FloatingUICore)}(this,(function(t,e){"use strict";function n(t){const e=t.getBoundingClientRect();return{width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left,x:e.left,y:e.top}}function o(t){return"[object Window]"===(null==t?void 0:t.toString())}function i(t){if(null==t)return window;if(!o(t)){const e=t.ownerDocument;return e&&e.defaultView||window}return t}function r(t){return o(t)?"":t?(t.nodeName||"").toLowerCase():""}function l(t){return t instanceof i(t).HTMLElement}function c(t){return t instanceof i(t).Element}function f(t){return t instanceof i(t).ShadowRoot||t instanceof ShadowRoot}function u(t){const{overflow:e,overflowX:n,overflowY:o}=getComputedStyle(t);return/auto|scroll|overlay|hidden/.test(e+o+n)}function s(t){return["table","td","th"].includes(r(t))}function d(t){return(e=t,(e instanceof i(e).Node?t.ownerDocument:t.document)||window.document).documentElement;var e}function a(t){return o(t)?{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}:{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function h(t){return n(d(t)).left+a(t).scrollLeft}function m(t,e,o){const i=l(e),c=d(e),f=n(t);let s={scrollLeft:0,scrollTop:0},m={x:0,y:0};return(i||!i&&"fixed"!==o)&&(("body"!==r(e)||u(c))&&(s=a(e)),l(e)?(m=n(e),m.x+=e.clientLeft,m.y+=e.clientTop):c&&(m.x=h(c))),{x:f.left+s.scrollLeft-m.x,y:f.top+s.scrollTop-m.y,width:f.width,height:f.height}}function p(t){return"html"===r(t)?t:t.assignedSlot||t.parentNode||(f(t)?t.host:null)||d(t)}function g(t){return l(t)&&"fixed"!==getComputedStyle(t).position?t.offsetParent:null}function y(t){const e=i(t);let n=g(t);for(;n&&s(n)&&"static"===getComputedStyle(n).position;)n=g(n);return n&&("html"===r(n)||"body"===r(n)&&"static"===getComputedStyle(n).position)?e:n||function(t){const e=navigator.userAgent.toLowerCase().includes("firefox");let n=p(t);for(;l(n)&&!["html","body"].includes(r(n));){const t=getComputedStyle(n);if("none"!==t.transform||"none"!==t.perspective||"paint"===t.contain||["transform","perspective"].includes(t.willChange)||e&&"filter"===t.willChange||e&&t.filter&&"none"!==t.filter)return n;n=n.parentNode}return null}(t)||e}function b(t){return{width:t.offsetWidth,height:t.offsetHeight}}function w(t){return i(t).getComputedStyle(t)}function v(t){return["html","body","#document"].includes(r(t))?t.ownerDocument.body:l(t)&&u(t)?t:v(p(t))}function x(t){var e;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const o=v(t),r=o===(null===(e=t.ownerDocument)||void 0===e?void 0:e.body),l=i(o),c=r?[l].concat(l.visualViewport||[],u(o)?o:[]):o,f=n.concat(c);return r?f:f.concat(x(p(c)))}function P(t,o){return"viewport"===o?e.rectToClientRect(function(t){const e=i(t),n=d(t),o=e.visualViewport;let r=n.clientWidth,l=n.clientHeight,c=0,f=0;return o&&(r=o.width,l=o.height,Math.abs(e.innerWidth/o.scale-o.width)<.001&&(c=o.offsetLeft,f=o.offsetTop)),{width:r,height:l,x:c,y:f}}(t)):c(o)?function(t){const e=n(t),o=e.top+t.clientTop,i=e.left+t.clientLeft;return{top:o,left:i,x:i,y:o,right:i+t.clientWidth,bottom:o+t.clientHeight,width:t.clientWidth,height:t.clientHeight}}(o):e.rectToClientRect(function(t){var e;const n=d(t),o=a(t),i=null===(e=t.ownerDocument)||void 0===e?void 0:e.body,r=Math.max(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),l=Math.max(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0);let c=-o.scrollLeft+h(t);const f=-o.scrollTop;return"rtl"===w(i||n).direction&&(c+=Math.max(n.clientWidth,i?i.clientWidth:0)-r),{width:r,height:l,x:c,y:f}}(d(t)))}function T(t){const e=x(p(t)),n=["absolute","fixed"].includes(w(t).position),o=n&&l(t)?y(t):t;return c(o)?e.filter((t=>c(t)&&function(t,e){var n;const o=null===(n=e.getRootNode)||void 0===n?void 0:n.call(e);if(t.contains(e))return!0;if(o&&f(o)){let n=e;do{if(n&&t.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}(t,o)&&"body"!==r(t)&&(!n||"static"!==w(t).position))):[]}const O={getElementRects:t=>{let{reference:e,floating:n,strategy:o}=t;return Promise.resolve({reference:m(e,y(n),o),floating:{...b(n),x:0,y:0}})},convertOffsetParentRelativeRectToViewportRelativeRect:t=>Promise.resolve(function(t){let{rect:e,offsetParent:o,strategy:i}=t;const c=l(o),f=d(o);if(o===f)return e;let s={scrollLeft:0,scrollTop:0},h={x:0,y:0};return(c||!c&&"fixed"!==i)&&(("body"!==r(o)||u(f))&&(s=a(o)),l(o)&&(h=n(o),h.x+=o.clientLeft,h.y+=o.clientTop)),{...e,x:e.x-s.scrollLeft+h.x,y:e.y-s.scrollTop+h.y}}(t)),getOffsetParent:t=>{let{element:e}=t;return Promise.resolve(y(e))},isElement:t=>Promise.resolve(c(t)),getDocumentElement:t=>{let{element:e}=t;return Promise.resolve(d(e))},getClippingClientRect:t=>Promise.resolve(function(t){let{element:e,boundary:n,rootBoundary:o}=t;const i=[..."clippingParents"===n?T(e):[].concat(n),o],r=i[0],l=i.reduce(((t,n)=>{const o=P(e,n);return t.top=Math.max(o.top,t.top),t.right=Math.min(o.right,t.right),t.bottom=Math.min(o.bottom,t.bottom),t.left=Math.max(o.left,t.left),t}),P(e,r));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}(t)),getDimensions:t=>{let{element:e}=t;return Promise.resolve(b(e))}};Object.defineProperty(t,"arrow",{enumerable:!0,get:function(){return e.arrow}}),Object.defineProperty(t,"autoPlacement",{enumerable:!0,get:function(){return e.autoPlacement}}),Object.defineProperty(t,"detectOverflow",{enumerable:!0,get:function(){return e.detectOverflow}}),Object.defineProperty(t,"flip",{enumerable:!0,get:function(){return e.flip}}),Object.defineProperty(t,"hide",{enumerable:!0,get:function(){return e.hide}}),Object.defineProperty(t,"limitShift",{enumerable:!0,get:function(){return e.limitShift}}),Object.defineProperty(t,"offset",{enumerable:!0,get:function(){return e.offset}}),Object.defineProperty(t,"shift",{enumerable:!0,get:function(){return e.shift}}),Object.defineProperty(t,"size",{enumerable:!0,get:function(){return e.size}}),t.computePosition=(t,n,o)=>e.computePosition(t,n,{platform:O,...o}),t.getScrollParents=x,Object.defineProperty(t,"__esModule",{value:!0})}));
{
"name": "@floating-ui/dom",
"version": "0.0.1",
"version": "0.1.0",
"description": "Floating UI for the web",

@@ -35,3 +35,3 @@ "main": "dist/floating-ui.dom.js",

"dependencies": {
"@floating-ui/core": "^0.0.1"
"@floating-ui/core": "^0.1.0"
},

@@ -38,0 +38,0 @@ "devDependencies": {

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